im making a game where if you click three things a door opens and the script wont work. ive found where the bug is and its that the if script wont work. anyway here is the code:
here is link https://pastebin.com/gDtz43ew
im making a game where if you click three things a door opens and the script wont work. ive found where the bug is and its that the if script wont work. anyway here is the code:
here is link https://pastebin.com/gDtz43ew
This part is your problem:
if book1 == 2 and leg1 == 2 and thing == 2 then
game.Workspace.Part1mo.Position = Vector3.new(120.312, 12.125, -19.625)
wait(5)
game.Workspace.Part1mo.Position = Vector3.new(120.312, 4.625, -19.625)
book1 = 1
leg1 = 1
thing = 1
end
It only runs once, you would have to run that code block every time one of the ClickDetectors is triggered. You could do that by wrapping it into a function like so:
function CheckStatus()
if book1 == 2 and leg1 == 2 and thing == 2 then
game.Workspace.Part1mo.Position = Vector3.new(120.312, 12.125, -19.625)
wait(5)
game.Workspace.Part1mo.Position = Vector3.new(120.312, 4.625, -19.625)
book1 = 1
leg1 = 1
thing = 1
end
end
And then add this function to the click detectors as follows:
script.Parent.MouseClick:Connect(function()
thing = 2
CheckStatus()
end)
book.ClickDetector.MouseClick:Connect(function()
book1 = 2
CheckStatus()
end)
leg.ClickDetector.MouseClick:Connect(function()
leg1 = 2
CheckStatus()
end)
thanks this is very helpful
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
That's because it only checks once, and immediately when you start the game.
ok but how do you make it check when its been done
I'd wrap it in a function and use it within each signal callback for a quick solve.
You can also enclose your code in a Lua Code Block, instead of giving a paste in link. Either that or at least make it a hyperlink for convince.