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

How can you make if/then statements run with multiple variables?

Asked by 6 years ago

So I'm making a tycoon and I've made it so that if all of the walls are bought, the if/then statement will execute and the pad will appear. For some reason, however, whenever all of the walls are bought, it does nothing. What is the problem?

if FrontWall.Parent == Tycoon and LeftWall.Parent == Tycoon and RightWall.Parent == Tycoon and LeftWall.Parent == Tycoon then
    FortificationPad.Parent = Tycoon

end

Thanks for the help

1 answer

Log in to vote
0
Answered by 6 years ago

This is because your if statement is not wrapped inside an event.

Event:Connect(function()
    -- Do code
end)

The event is whatever event. Technically you can use an infinite loop, but that’s bad practice.

Ad

Answer this question