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

My script won't move when the value is true?

So when I set the Value to true the death sound still plays, meaning that the script did not see that the Value was true:

local Position = Vector3.new()  
local Monster1 = game.Workspace.Nightmare
local Monster2 = game.Workspace.Nightmare2
wait(25)
Monster1.Position = Vector3.new(4.366, 6.608, 20.635)
print("Moved")
if Monster1.Position == Vector3.new(4.366, 6.608, 20.635) and game.Workspace.EndoCurtain7.Curtain.Value.Value == true then
	wait(3)
	Monster1.Position = Vector3.new(-41.254, 9.873, 15.47)
	print("Ran")
	else
	wait(10)
	game.Workspace.DeathSound:Play()
end
if Monster2.Position == Vector3.new(10.852, 6.541, 21.017) and game.Workspace.EndoCurtain1.Curtain.Value.Value == true then
	wait(3)
	Monster2.Position = Vector3.new(-41.254, 9.873, 15.47)
	print("Ran")
else
	wait(10)
    game.Workspace.DeathSound:Play()
end
wait(15)
Monster2.Position = Vector3.new(10.852, 6.541, 21.017)

Any ideas?

3 comments

0

This is why testing helps. Try going onto the serverside by playing the game and clicking the clientside button in the home tab of studio, then check if the value is true or not.

0

I checked it and the value is true when I activate the EndoCurtain. When I De-Activate it the Value changes, meaning that the EndoCurtain works.

1 answer

✓ Accepted answer

My best guess is to make it loop. Looking at the program it will only ever run once.

5 comments

0

But that’s not what I need. Do you mean the part that checks the value?

0

Yes. If you put a if function in a script, it will only ever run it once. However if you put it in a loop it will occur when the conditions are met!

0

Also, if you only want it to run at a certain time, give the loop a condition, such as

0

while runProgram == true do

0

Ahh. Thanks a lot!

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