Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't my Remote Event being called?

I made a script where when you click it plays an animation and calls a RemoteEvent but for some reason it isn't triggering the RemoteEvent.

 tool = script.Parent
replicatedstorage = game:GetService("ReplicatedStorage")
PunchEvent = replicatedstorage.RicoClass.Punch
staticball = replicatedstorage.RicoClass:findFirstChild("Lightning")
cooldown = false



tool.Selected:connect(function(mouse)
mouse.Button1Down:connect(function()
	
if not cooldown then
	cooldown = true
	local player = game:GetService("Players").LocalPlayer
----------dont pay attention to this part----------------------------------------------------------	
	local Energy = player:FindFirstChild("PlayerGui"):FindFirstChild("ScreenGui"):FindFirstChild("TextButton").TextBox.EnergyValue
	game:WaitForChild(player)
game:WaitForChild(Energy)	
	if Energy.Value >= 30 then
		Energy.Value = Energy.Value - 30
		
--------------------------------------------------------------------------------------------------------------
	local player = game.Players.LocalPlayer
	local Humanoid = player.Character.Humanoid
---------------------------------------------------------------------------------
		local Punch = Instance.new("Animation")
		Punch.AnimationId = "http://www.roblox.com/Asset?ID=644505212"
		local animTrack = Humanoid:LoadAnimation(Punch)	
			animTrack:Play(0,2,2.5)
---------------------------------------------------------------------------------
	
PunchEvent:FireServer(mouse.Hit) ---------------this part is it broken?
end
wait(0.4)
cooldown = false


end

end)
end)





1 comment

0

pls help

1 answer

✓ Accepted answer

You need a separate script, that script of yours only works in LocalScript so make another trying to call. And you are right, the "mouse.hit" is the problem, you'll need to fix that. I saw one of these questions yesterday, the problem was the mouse.hit when calling the event.

This discussion is preserved as it was. New answers, comments, and votes are closed.