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

Player pad map chooser?

How could i get it so a play can select a map with pads for example: Murder Mystery. I made one with a mouse hover function but... the second round its not stable.

Here is the function i am using to give the pads a task. It works for like one round but then the second loop it does not fire right, no map titles. This all works fine until the map titles don't show the next round or game.

List1 = Game.Lighting.List1:GetChildren()
List2 = Game.Lighting.List2:GetChildren()
List3 = Game.Lighting.List3:GetChildren()
Randomize1 = List1[math.random(1,#List1)]
Randomize2 = List2[math.random(1,#List2)]
Randomize3 = List3[math.random(1,#List3)]
script.Map1.Value = Randomize1.Name
script.Map2.Value = Randomize2.Name
script.Map3.Value = Randomize3.Name

1 answer

✓ Accepted answer

Well, it appears you'd need this to be called every time it starts the new game? So there are two ways to do that.

  1. Disable the script and then re-enable it when the map needs to be picked
  2. Call it as a function
function random_map()
	List1 = Game.Lighting.List1:GetChildren()
	List2 = Game.Lighting.List2:GetChildren()
	List3 = Game.Lighting.List3:GetChildren()
	Randomize1 = List1[math.random(1,#List1)]
	Randomize2 = List2[math.random(1,#List2)]
	Randomize3 = List3[math.random(1,#List3)]
	script.Map1.Value = Randomize1.Name
	script.Map2.Value = Randomize2.Name
	script.Map3.Value = Randomize3.Name
end

start.MouseButton1Click:connect(random_map) --Just an example, you'd want to connect a different event so that it randomizes a map after each game

1 comment

0

Oh, here is. Li

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