Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't my RemoteEvent being called??

Asked by
rexpex 45
7 years ago

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 answer

Log in to vote
0
Answered by 7 years ago

You are sending over mouse.Hit to the server. I'm guessing you're using mouse.Hit for the mouse position. Instead, use mouse.Hit.p

Ad

Answer this question