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

help me with this math.Random script?

Hey, so I'm making a game that requires math.Random for a map to appear. I don't completely understand how to use it, so here it is

math.Random#(Maps 1,3)
If math.Random = 1 then
game.ServerStorage.1.Parent = "WorkSpace"

I'm stuck after that. I guessed how to do the whole thing. Help me please?

1 answer

✓ Accepted answer

If what you're trying to do is make a map appear based on a random number then try this-

Maps = {"Map1", "Map2", "Map3"} --Change these to the names of your maps
n = math.random(1, 3) --Finds a random number between 1, and the number of maps you have
Map = game.ServerStorage:FindFirstChild(Maps[n]) --Go into ServerStorage and find the names of the maps listed in the table, and the corresponding random number.
Map.Parent = game.Workspace --Take the map out of ServerStorage and place it into the Workspace

2 comments

0

I'll let you now how it goes,

0

worked!

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