Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I stop a value from changing?

I want to stop a value changing so the stun wont become false during wait. (Without using loops otherwise it crashes the game/makes it really laggy)

--V is a character
--Stunned is a bool value

task.spawn(function()
	v.Stunned.Value = true	
    --v.Stunned.CanChange = false
    wait(stunTime)
    --v.Stunned.CanChange = true
	v.Stunned.Value = false	
end)

2 comments

0

Are u 100% sure its happening during the wait?

0

You could create a second bool value named StunnedCanChange, and set and check that when you want

1 answer

Ah, a stunned system. I just struggled with one of this a little while ago. The fix I came up with was not letting the player get stunned if they are already stunned.

if v.Stunned == true then return else
	v.Stunned.Value = true
	task.wait(stunTime)
	v.Stunned.Value = false
end

If this wasn't what you needed sorry, but this is what I did for my system.

This discussion is preserved as it was. New answers, comments, and votes are closed.