-- I like being simple.


local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local Receiver = Tool:WaitForChild("Receiver")
local Flash = Tool:WaitForChild("Flash")
local Spur = Flash:WaitForChild("Image")
local Smoke = Flash:WaitForChild("ImageTwo")

Receiver.OnServerEvent:connect(function (player, action, ...)
	local Data = {...}
	if action and Data then
		if action == "PlaySound" then
			if Handle:FindFirstChild(Data[1]) then
				Handle[Data[1]]:Play()
			end
		elseif action == "Flash" then
			Handle:WaitForChild("Flash").Enabled = Data[1]
			Flash:WaitForChild("Embers").Enabled = Data[1]
			Spur:WaitForChild("Flash").Rotation = math.random(0, 360)
			Smoke:WaitForChild("Flash").Rotation = math.random(0, 360)
			Spur.Enabled = Data[1]
			Smoke.Enabled = Data[2]
		elseif action == "Damage" then
			if Data[1]:IsA("Humanoid") and type(Data[2]) == "number" then
				Data[1]:TakeDamage(Data[2])
			end
		end
	end
end)
