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

random map changer script not working help?

Asked by
Idleino 11
5 years ago
Edited 5 years ago

iv'e made a random map changer script and when i try to play it on studio roblox studio crashes and when i play the game the script not working can someone help me fix this? thanks

local map1 = game.ServerStorage.Maps.Map1 local map2 = game.ServerStorage.Maps.Map2 local map3 = game.ServerStorage.Maps.Map3 local map4 = game.ServerStorage.Maps.Map4 local map5 = game.ServerStorage.Maps.Map5

while true do local random = math.random(1, 5) if random == 1 then map1.Parent = game.Workspace map2.Parent = game.ServerStorage.Maps map3.Parent = game.ServerStorage.Maps map4.Parent = game.ServerStorage.Maps map5.Parent = game.ServerStorage.Maps end if random == 2 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.Workspace map3.Parent = game.ServerStorage.Maps map4.Parent = game.ServerStorage.Maps map5.Parent = game.ServerStorage.Maps end if random == 3 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.ServerStorage.Maps map3.Parent = game.Workspace map4.Parent = game.ServerStorage.Maps map5.Parent = game.ServerStorage.Maps end if random == 4 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.ServerStorage.Maps map3.Parent = game.ServerStorage.Maps map4.Parent = game.Workspace map5.Parent = game.ServerStorage.Maps end if random == 5 then map1.Parent = game.ServerStorage.Maps map2.Parent = game.ServerStorage.Maps map3.Parent = game.ServerStorage.Maps map4.Parent = game.ServerStorage.Maps map5.Parent = game.Workspace end end

0
Put all your code inside a code block when asking your question, that way it's easier for us to understand and see. Pojoto 329 — 5y
0
use clone() and destroy() PropzFx 27 — 5y

1 answer

Log in to vote
0
Answered by
aazkao 787 Moderation Voter
5 years ago

You need to add a wait() in your while loop

Ad

Answer this question