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

How do I reference every players name on the server?

Asked by 4 years ago

I want to make a script that gives a StringValue your name unless someone elses name (on the server) already is the value.

2 answers

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

I'm guessing you want a random player for the server, and unless someones else's name is already on the server it will automatically choose one.

local StringValue = Instance.new('StringValue')
StringValue.Parent = game:GetService('Workspace') --//You Can Change this Destination\\--
local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
local plrname = randomPlayer.Name
if StringValue.Value == nil then
StringValue.Value = plrname
end
0
Don't spoon - feed people @jayStepherdMD Unscriptablee 20 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Nevermind I was just stupid you just say "if StringValue == nil then"

0
That's what I put at first but then I edited it. JayShepherdMD 147 — 4y
0
and it's StringValue.Value, please put that I answered your question so this forum can be closed. JayShepherdMD 147 — 4y

Answer this question