My Local Script

wait()
local Player = game:GetService("Players").LocalPlayer -- Game gets access to "Players" asset and then takes a local player from it (it's basically the same but more organized).
local char = Player.Character
local Mouse = Player:GetMouse()
local cooldown = 0
local replicatedstorage = game:GetService("ReplicatedStorage")

Player.Chatted:Connect(function(message)
	message = message:lower()
	if message == "Burn" then
		game.ReplicatedStorage.Pain:FireServer(3444669792,Mouse.hit)
		wait(1.62)
	end
end)

My Server Script.

game:GetService("ReplicatedStorage"):FindFirstChild("Pain").OnServerEvent:Connect(function(player,animationID,Mouse)
	Mouse.Button1Down:Connect(function(hit)
	local humanoid = Mouse.hit.Parent:FindFirstChild("Humanoid")
			
	local animation = Instance.new("Animation")
	animation.AnimationId = "http://www.roblox.com/Asset?ID="..animationID
	
	local loadedAnimation = humanoid:LoadAnimation(animation)
	loadedAnimation:Play()
	wait(2.65)
	loadedAnimation:Stop()
	loadedAnimation:Destroy()
					
	end)
end)

Not outputting errors, please someone help me and tell me how to fix.

4 comments

0

For those who can't see my full line of text on the First line of my Server script, looks like this

0

game:GetService("ReplicatedStorage"):FindFirstChild("Pain").OnServerEvent:Connect(function(player,animationID,Mouse)

0

rather than connecting the Mouse event, why not use Mouse.Target and use FindFirstChild to check if it exists?

0

Correct me if I'm wrong but you can't use .Chatted:Connect(function() on the client. Just do it all on the server.