Can't set variable to false in loop

So, I’m basically trying to set a variable false in a loop but it isn’t working and I need to use a loop for this anyways around this?

CODE

while Controls.up == 1 do
		game:GetService("RunService").Stepped:Wait()
		local UpRay = Ray.new(humrp.Position, humrp.CFrame.lookVector * 5)
		local hitfront, position = game.Workspace:FindPartOnRayWithIgnoreList(UpRay, {head,humrp,hat})
		if not hitfront then
				print("There is nothing here.")
				hum:LoadAnimation(ClimbAnimations.Ledge):Play()
				repeat game:GetService("RunService").Stepped:Wait()
				Controls.up = 0 and print('sdfgsdf')
				until Climbing == false
				wait(1.1)
				Climbing = false
				print(Climbing)
				climb:Destroy()
				hum.PlatformStand = false
				local Ledge = TweenService:Create(humrp, TweenInfo.new(.5), {CFrame = humrp.CFrame + Vector3.new(0,1.2,-3.5)})
				Ledge:Play()
			end
		end

You never localized the “hum” variable that is why.

Uh, sir that is just a piece of the code, I snipped, I defined “hum” earlier in the script, I assure you it’s not that

So this part of the script is the part that isn’t working?

Well, it’s working it just doesnt want to set the variable “Climbing” to false for some reason

Maybe add print statements to check if the previous code isn’t working.

Oh I fixed it, I had the repeat until before everything else thanks for the suggestions!

1 Like

You’re repeating until Climbing is false, but you are setting it to false afterwards (meaning it never gets set to false). I’m not sure what your script is meant to do but I’m pretty sure this is the probable reason.

Edit, guess I was too late lol

Yeah just figured that out, thanks!

Alright cool! (30 charsssssss)