local Rep = game:GetService("ReplicatedStorage") local Event = Rep:WaitForChild("YAS") Event.OnServerEvent:Connect(function(plr) local leaderstats = plr:FindFirstChild("leaderstats") leaderstats.Strength.Value += 1 -- Shorthand unary operator for "leaderstats.Strength = leaderstats.Strength + 1" end)
That's basically the ServerScriptService ( Which add u the stats )
And that's my StarterPlayerScripts
local UIS = game:GetService("UserInputService") local Replicated = game:GetService("ReplicatedStorage") local Event = Replicated:WaitForChild("YAS") UIS.InputBegan:Connect(function(Key) if Key.KeyCode == Enum.KeyCode.E then Event:FireServer() end end)
So basically as far as I know I gotta add in the ServerScriptService load animation that I made. Idk how to do that, Thanks tho :)
Go ahead and accept the other guys answer but he didnt go into farther detail. I believe you are looking for:
local UIS = game:GetService("UserInputService") local anim = Instance.new("Animation") anim.AnimationId = "ANIMATIONIDHERE" local animTrack = char.Humanoid:LoadAnimation(anim) local Replicated = game:GetService("ReplicatedStorage") local Event = Replicated:WaitForChild("YAS") UIS.InputBegan:Connect(function(Key) if Key.KeyCode == Enum.KeyCode.E then Event:FireServer() animTrack:Play() wait(3) - configure to what you want depending on how long the animation plays AnimTrack:Stop() end end)
From what I remember animations on your own character can be replicated from the client, so there is no need for playing it server side.
But if you want to play on server or client, you just need to get Player.Character, then its humanoid and get the animation object to load:
local char = player.Character if char and char:findFirstChild("Humanoid") then local anim = Instance.new("Animation") anim.AnimationId = "ANIMATIONIDHERE" local animTrack = char.Humanoid:LoadAnimation(anim) animTrack:Play() end