|
| 04 Oct 2017 09:15 PM |
I'm trying to make a weapon that play an animation through a remote event, but for some reason, either the event is not firing or there's something wrong with the local script.
Here is the code
Main script
Tool = script.Parent local Handle = Tool:WaitForChild("Handle") local Event = Tool:WaitForChild("RemoteEvent") local lastclick = tick() local animationtime = 1 local Player = nil Tool.Equipped:connect(function(Mouse) local character = Tool.Parent lastclick = tick() Player = game.Players:GetPlayerFromCharacter(character) local Humanoid = character:FindFirstChild("Humanoid") if Humanoid then end end)
Tool.Activated:connect(function() local clickdelta = tick() - lastclick if clickdelta > animationtime then lastclick = tick() Event:FireClient(Player, "play_animation", "basic_swing") end end)
Local Script
Tool = script.Parent local Basic_swing_anim = Tool:WaitForChild("BasicSwing") local Script = Tool.Script local Event = Tool:WaitForChild("RemoteEvent") local Tool_Player = Tool.Parent.Name Event.OnClientEvent:connect(function(...) local tuple = (...) if tuple[1] == "play_animation" then if tuple[2] == "basic_swing" then local Humanoid = Tool_Player:WaitForChild("Humanoid") local Basic_swing_track = Humanoid:LoadAnimation(Basic_swing_anim) Basic_swing_track:Play() print("Message recieved") end end end) |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 04 Oct 2017 09:16 PM |
im pretty sure playing an animation replicates to the server
|
|
|
| Report Abuse |
|
|
|
| 04 Oct 2017 10:10 PM |
| Does that also count print functions too? Because even the print("Message recieved") I have near where the animation is played does print also. |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Oct 2017 09:48 AM |
Putting the print("Message Recived") there dosent do you any justice cause you already know its not working there.
Put the prints behind the if statements |
|
|
| Report Abuse |
|
|