So I've been trying to script a simple punch animation that plays when you left click.
I'm using a local script, a server script and a remote event to run it.
Here's the Server Script:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,animationID) local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.come/Asset?ID="..animationID local loadedAnimation = game.Workspace[player.Name].Humanoid:LoadAnimation(animation) loadedAnimation:Play() print("Punched") end)
And here's the Local Script:
game:GetService("UserInputService").InputBegan:Connect(function(input, engine_processed) if engine_processed then return end if input.UserInputType == Enum.UserInputType.MouseButton1 then game.ReplicatedStorage.RemoteEvent:FireServer(7199296854) print("Yes") end end)
My friend (The owner) joined and the punching animation worked for him and I could see it. I thought it was because he was the owner so I asked him to join on his other account and it still worked, but when I tried to punch it did not work.