What is a debounce?

local UpUp = false

local function bbebe(debounce, amount)	
	while debounce do
		task.wait(.5)
		camera.CFrame = camera.CFrame * amount
	end
end
UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Up then
		UpUp = false
end)
UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Up then	
		UpUp = true
		task.spawn(bbebe, UpUp, CFrame.Angles(2,0,0))	
	end
end)

for some reason the while loop still plays even though the debounce gets set to false. Do you know why?

1 Like

Because you’re sending the variable “UpUp” to a function. The function would not know
when the boolean has been set to false since it’s a parameter

You can simply just do:

local function bbebe(amount)	
	while UpUp do
		task.wait(.5)
		camera.CFrame = camera.CFrame * amount
	end
end
1 Like

by the way, this is off topic, but how do I set the angle of a CFrame? I know multiplying a cframe by an angle adds the number you are multiplying but how do I straight up set the value?

I’m trying to set the Z axis of CFrame.Angles() to 0.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.