Script not running after boolvalue is enabled

I’m making a space rocket for my friend, when a bool value is on then the engines are meant go on, but its not working. help would be great.

if script.Parent.Parent.Parent.ON.Value == true  then
--script.Parent.Parent.Parent is the model in which the value is located in.
	script.Parent.Exhaust.Enabled = true
	wait(4)
	script.Parent.Exhaust.Enabled = false
	wait(1)
	script.Parent.Flame2.Enabled = true
	script.Parent.ParticleEmitter.Enabled = true
end

image
(Theres no errors in the output too.)

1 Like

I might need more of the Hierarchy, I can see script’s parent but not it’s parent and it’s parent’s parent
EDIT: Also, for easier usage, just name your variables (like local engine = script.Parent; local … = engine.Parent and so on)

But what sets the ON.Value to true?
If you never successfully set it to true then this section of code won’t ever work.

image

In the last section of code just put:
print("mouse clicked")
inside that bit to see if it actually fires.

Try creating a variable for the BoolValue itself first, then set that variable to true:

local boolVal = script.Parent.Parent.Parent.ON

boolVal.Value = true

image

So is the first section of code inside a loop or a function? If it isn’t then it only runs once.
Try putting that section inside the clickdetector section of script so if fires each time the clickdetector fires.

apologizes for bumping this, forgot to add a loop

1 Like

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