Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.