Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I can't seem to figure out what is wrong with this item script can i have some help?

Asked by 5 years ago

so i tried making an item that heals and increaces the walkspeed, but it seems to not work local CanActivate = true local player = game.Players.LocalPlayer local character = player.Character

script.Parent.Activated:Connect(function() if CanActivate == true then CanActivate = false local animation = character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play() wait(1) character.Humanoid.Health = character.Humanoid.MaxHealth character.Humanoid.Walkspeed = Humanoid.WalkSpeed + 10 wait(1) wait(60) CanActivate = true end end)

1 answer

Log in to vote
0
Answered by 5 years ago

If I'm not mistaken, I believe that you were missing "character" and "Walkspeed" is supposed to be spelt "WalkSpeed" in this line:

character.Humanoid.WalkSpeed = character.Humanoid.WalkSpeed + 10

local CanActivate = true 
local player = game.Players.LocalPlayer 
local character = player.Character

script.Parent.Activated:Connect(function() 
    if CanActivate == true then 
        CanActivate = false 
        local animation = character.Humanoid:LoadAnimation(script.Parent.Animation)                         
        animation:Play() 
        wait(1) 
        character.Humanoid.Health = character.Humanoid.MaxHealth            
        character.Humanoid.Walkspeed = character.Humanoid.WalkSpeed + 10 
        wait(1) 
        wait(60) 
        CanActivate = true 
    end 
end)
Ad

Answer this question