generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Remote Event playing animation

Previous Thread :: Next Thread 
KidCalledFox is not online. KidCalledFox
Joined: 05 May 2013
Total Posts: 96
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 is online. 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
KidCalledFox is not online. KidCalledFox
Joined: 05 May 2013
Total Posts: 96
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
KidCalledFox is not online. KidCalledFox
Joined: 05 May 2013
Total Posts: 96
05 Oct 2017 09:04 AM
Bump
Report Abuse
VineyardVine is not online. VineyardVine
Joined: 20 Nov 2010
Total Posts: 904
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image