I’ve got a function that lets a player climb, it is a custom climbing script I made a few days ago. It is activated by the event Torso.Touched.
My problem is whenever it is touched, it sets a bool to true, and when the output should print true AND ONLY true, it instead prints something like this
true, false, true, false, true, false, true, false – It kinda just bounces between the 2???
Here is an EXTREMELY simplified version of it.
local Player = game.Players.LocalPlayer
local Character = script.Parent
local Torso = Character:WaitForChild("Torso")
local DebugWall = false
Torso.Touched:Connect(function ()
DebugWall = true
end)
while task.wait(0.1) do
print(DebugWall)
end
if you insert this into StarterCharacterScripts you should get my problem
local Player = game.Players.LocalPlayer
local Character = script.Parent
local Torso = Character:WaitForChild("Torso")
local DebugWall = false
local Debounce = false
Torso.Touched:Connect(function ()
if not Debounce then
DebugWall = true
Debounce = true
end
end)
while task.wait(0.1) do
print(DebugWall)
end
task.wait(1)
Debounce = false