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

How would I make a script that is able to get a random players avatar and name? (Camping Game)

Asked by 5 years ago

I am looking for someone who is able to help me make a script that selects a random player from the player list. I also want the script to get their avatar and username. I was using a local player script but then I realized that the player would see their own avatar instead of random players.

I made a little example of the GUI design.

Link to design: http://prntscr.com/olrdta

Where it says "name" I want it to select a random player from the players list and display their avatar and name.

The black border is where the random avatar image will appear.

The name text is where the random players name will appear.

This is for roblox btw.

0
for getting a random player you could just do game:GetService("Players"):GetPlayers()[math.random(1, #game:GetService("Players"):GetPlayers())] and for getting a player avatar use player:GetUserThumbnailAsync (wiki: https://developer.roblox.com/en-us/api-reference/function/Players/GetUserThumbnailAsync) msuperson24 69 — 5y
0
Otherwise this aint a request site msuperson24 69 — 5y
0
Thanks this is all new to me. iiMxtt_Destinyii 62 — 5y
0
How do I make that into a script? iiMxtt_Destinyii 62 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Okay Make a ****RemoteEvent**** Call it Dialogue Put it in ReplicatedStorage And Make a ****Script**** Here's a script: l


local dialogue = game.ReplicatedStorage.Dialogue local type = Enum.ThumbnailType.HeadShot local size = Enum.ThumbnailSize.Size180x180

function Message(player, speech, id) dialogue:FireAllClients(player, speech, id) end wait(5) local players = game.Players:GetChildren() local player = players[math.random(1, #players)] local id = game.Players:GetUserThumbnailAsync(player.UserId, type, size) Message(player, "Example Here", id)

And Heres a local script in the gui


local dialogue = game.ReplicatedStorage.Dialogue local frame = script.Parent.Frame local thumbnail = frame.Thumbnail local text = frame.Dialogue local player = thumbnail.Player

function Message(speech) for i = 1, #speech do text.Text = string.sub(speech, 1, i) wait() end end

dialogue.OnClientEvent:Connect(function(plr, speech, id) player.Text = plr.Name thumbnail.Image = id Message(speech) end)

0
Just make an Frame And A thumbnail with a textlabel called Player and a textlabel Called Dialogue GodOfTemplates 10 — 5y
Ad

Answer this question