so hey! it's me, some random guy who's bad at scripting, pwgth. so a bit ago, I made a question: "Why do our scripts only work for ourselves?" which a very kind person, gave us an answer on why.
so afterward, I and my friend composed brand new scripts! (which don't work) and that's why I'm here. Does anybody know what I did wrong? I put these both in starter character scripts btw.
local script:
local mouse = game.Players.LocalPlayer:GetMouse()
local rep = game.ReplicatedStorage
mouse.KeyDown:connect(function(key)
if key=="f" then
rep.Punch:FireServer()
end
end)
script:
local rep = game.ReplicatedStorage
local animation = rep.Folder["punchy boi"]
local trackanimation = nil
local playability = true
rep.punch.OnServerEvent:Connect(function(player)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation (animation)
trackanimation.KeyframeReached:Connect(function()
print("10!")
end)
trackanimation:play()
end
end)
I highlighted the stuff I thought was important to make sure yall didn't miss out on em lol.
peace! -pwgth

4 comments
you don't need to reference the localplayer since you already did in the client script, since :FireServer() returns the player
on line 11 try: trackanimation = player.Character.Humanoid:LoadAnimation(animation)
also, the other script should be a normal script placed in either serverscriptservice or workspace
i might post an answer soon