- So basically i have this punch script and i would like to make it so when you punch your strength goes up in leaderstats. How do i go about adding to that value everytime left click is fired.
2)How do i add a delay for the animation so it is not spammed, I tried with wait(10) but that did nothing
Heres the animaton script
local Plr = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://5005123017"
local track = Humanoid:LoadAnimation(Anim)
UserInputService.InputBegan:Connect(function(InputObject)
if InputObject.UserInputType == Enum.UserInputType.MouseButton1 then
track:Play()
wait(10)
end
end)
And heres my leaderstat(forgot to add)
function onPlayerEntered(newPlayer)
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local strength = Instance.new("IntValue")
strength.Name = "Strength"
strength.Value = 0
strength.Parent = stats
stats.Parent = newPlayer
end
game.Players.ChildAdded:connect(onPlayerEntered)

3 comments
Wouldn't you need a RemoteEvent to increase their stats? Since you're increasing their stats in a local script it won't replicate to the Server.
Yes you would
I just started scripting today so im not sure what exactly to do, does your script require a remote event? if so i'll read up on it and try it out