Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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?

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. haba_nero 386 — 4y
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. Cynical_Innovation 595 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

0
But that’s not what I need. Do you mean the part that checks the value? Cynical_Innovation 595 — 4y
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! PoppyandNeivaarecute 134 — 4y
0
Also, if you only want it to run at a certain time, give the loop a condition, such as PoppyandNeivaarecute 134 — 4y
0
while runProgram == true do PoppyandNeivaarecute 134 — 4y
0
Ahh. Thanks a lot! Cynical_Innovation 595 — 4y
Ad

Answer this question