i have a simple bat that strikes (plays an animation) when clicked, but does not work
localscript:
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() local bat = script.Parent bat.Activated:Connect(function() local Animation = Instance.new("Animation", plr.Character) Animation.AnimationId = "rbxassetid://01575838216" local animtrack = plr.Character.Humanoid:LoadAnimation(Animation) bat.Strike:FireServer(plr, animtrack) end)
serverscript:
local bat = script.Parent bat.Strike.OnServerEvent:Connect(function(plr,animtrack) animtrack:Play() end)
Hi wookey12,
Thanks,
Best regards,
~~ KingLoneCat
Get rid of plr in the line: bat.Strike:FireServer(plr, animtrack)
When sending a server event it automatically sends plr with it, which means you only need to have plr in the event receiving it. If you keep "plr" there it will detect the animation track as the plr.
Because it auto-sends plr with it, it will be like the above. Which means,
plr = plr
animtrack = plr
And the animtrack will not be identified as a variable.
Which also means your int value will be identified as a reference to the local player.