Change speed and destory not working

so i changed a script inside a noob chip tool, and heres what i changed:

local Tool = script.Parent;
local Player = game.Players.LocalPlayer
enabled = true




function onActivated()
	if not enabled  then
		return
	end

	enabled = false
	Tool.GripForward = Vector3.new(0.675, -0.675, -0.3)
	Tool.GripPos = Vector3.new(0.4, -0.9, 0.9)
	Tool.GripRight = Vector3.new(0.212, -0.212, 0.954)
	Tool.GripUp = Vector3.new(0.707, 0.707, 0)
	Player.Humanoid.walkspeed = 5


	Tool.Handle.DrinkSound:Play()
	
	wait(5)
	Player.Humanoid.walkspeed = 16
	Tool:Destroy()
	local h = Tool.Parent:FindFirstChild("Humanoid")
	if (h ~= nil) then
		if (h.MaxHealth > h.Health + 1.6) then
			h.Health = h.Health + 1.6
		else	
			h.Health = h.MaxHealth
		end
	end

	Tool.GripForward = Vector3.new(-1, 0, 0)
	Tool.GripPos = Vector3.new(.2, 0, 0)
	Tool.GripRight = Vector3.new(0, 0, -1)
	Tool.GripUp = Vector3.new(0,1,0)


	enabled = true

end

function onEquipped()
	Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

i want player go to at 5 speed for 5 second when eating it and the chip destroy itself after the player finishes eating and gain back his speed…the problems is the modify vision of mine is not working and the chip is stuck in the position

1 Like

anything printed on the output?

Try changing walkspeed to WalkSpeed.
(Line 18 and 24)

Oh yeah actually he is right, this has been mispelled

1 Like

its still stuck in my face and im 16 speed(and its not destroying)

show us the output, we need an error to solve

This should be fixed since I had to fix it by using your script.

local Tool = script.Parent;
enabled = true




function onActivated()
	if not enabled  then
		return
	end

	enabled = false
	Tool.GripForward = Vector3.new(0.675, -0.675, -0.3)
	Tool.GripPos = Vector3.new(0.4, -0.9, 0.9)
	Tool.GripRight = Vector3.new(0.212, -0.212, 0.954)
	Tool.GripUp = Vector3.new(0.707, 0.707, 0)
	script.Parent.Parent.Humanoid.WalkSpeed = 5


	Tool.Handle.DrinkSound:Play()

	wait(5)
	script.Parent.Parent.Humanoid.WalkSpeed = 16
	local h = Tool.Parent:FindFirstChild("Humanoid")
	if (h ~= nil) then
		if (h.MaxHealth > h.Health + 1.6) then
			h.Health = h.Health + 1.6
		else	
			h.Health = h.MaxHealth
		end
	end

	Tool.GripForward = Vector3.new(-1, 0, 0)
	Tool.GripPos = Vector3.new(.2, 0, 0)
	Tool.GripRight = Vector3.new(0, 0, -1)
	Tool.GripUp = Vector3.new(0,1,0)


	enabled = true
	Tool:Destroy()
end

function onEquipped()
	Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
1 Like

better to add a repeat until at the start of the script

yay tysm it worked!!! this took me days on my own lol

1 Like

I was rushing with the code, but it still would work.

as long as it work, this is all foxnoobkite ask