player.Character.Humanoid.ragdoll.Value = true to false after the loop is done?
what i mean is:
i have a loop that checks if something is above a certain value, if it is i want to set the ragdoll value to false.
would this work?
local passedOut = false
magic.Value.Changed:Connect(function()
if magic.Value < 150 and passedOut == false then
passedOut = true
game.ReplicatedStorage.Message:FireClient(player, "You have passed out due to exhaustion.")
player.Character.Humanoid.ragdoll.Value = true
repeat
wait()
until magic.Value > 150
player.Character.Humanoid.ragdoll.Value = false
Think of a repeat until loop as the opposite of a while loop, if a while loop is checking if a condition is true, then a repeat until loop will repeat until the condition is false
while Condition == true do
end
repeat
until Condition == false
You’d make an if statement when the value of magic is greator than 150.
Try this:
local passedOut = false
magic.Value.Changed:Connect(function()
if magic.Value < 150 and passedOut == false then
passedOut = true
game.ReplicatedStorage.Message:FireClient(player, "You have passed out due to exhaustion.")
player.Character.Humanoid.ragdoll.Value = true
repeat
wait()
until magic.Value > 150
print(magic.Value)
if magic.Value > 150 then
player.Character.Humanoid.ragdoll.Value = false
end
Looking at the loop, you are yielding the code until the value is greater so it appears so, but add an if statement just to be sure as @ValiantWind put in his code