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

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

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

✓ Accepted answer

###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.

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