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

How do you make a random person talk in gui?

Asked by 4 years ago

How do you do the thing like camping they choose a random player to talk in gui how do i do this (help)?

0
You mean a dialog system? chafava -113 — 4y
0
no the gui GodOfTemplates 10 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

If your asking how to get a random player, this is it.


math.randomseed(tick()) if #game.Players:GetPlayers() > 0 then local rand = math.random(1,#game.Players:GetPlayers()) -- The # is used to get the amount of inputs in a table. local randomplayer = game.Players:GetPlayers()[rand] -- Returns an objectvalue for player. print(randomplayer) end

Please note, put this script inside a function or a disabled script, as when you press test, or on Roblox itself, the server starts before the client, and before the client joins the script would have already ran.

(Tested and works)

Now as for setting up a GUI, you will just have to use the information from the player to create it.

Ad

Answer this question