Still teleporting even if the walkspeed is 0

still teleporting even if the walkspeed is 0
script:

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local humrp = char:WaitForChild("HumanoidRootPart")
local uis = game:GetService("UserInputService")
local debris = game:GetService("Debris")

local part = Instance.new("Part")
local effect = game:GetService("ReplicatedStorage"):WaitForChild("VP")
part.Transparency = 1
part.CanCollide = false




local debounce = false
uis.InputBegan:Connect(function(input, istyping)
	if istyping or debounce  or hum.WalkSpeed == 0 then return end

	if input.KeyCode == Enum.KeyCode.E then
	
		debounce = true
		local clone = part:Clone()
		local clone2 = effect:Clone()
	
		clone.Anchored = true
		debris:AddItem(clone,0.50)
		clone.Parent = workspace
		clone2.Parent = clone
 		clone.CFrame = humrp.CFrame


		task.wait(0.0002)
		humrp.CFrame = humrp.CFrame * CFrame.new(0,0,-10)

		print("ok")

		task.wait(3)
		debounce = false
	end
end)

local script in starterpack
effect is in replicated storage

1 Like

Instead of using OR, use AND

If you use OR you saying if one of your ifs is true then it runs the rest of the code. But using AND your saying “this and that” both have to be true

If… AND hum.WalkSpeed == 0 then return end…

1 Like