So, not only will I answer your question but I will bring it up a notch:
Player=game.Players.LocalPlayer
PGui=Player:WaitForChild("PlayerGui")
NomGui=PGui:WaitForChild("NominationGUI")
function PS(st)
if game.Players:FindFirstChild(st) then
local player=game.Players[st]
print("You selected "..player.Name
end
end
function Nominate()
local template = game.Lighting.Template
local num = 0.2
for i,v in pairs(game.Players:GetChildren()) do
templateclone = template:clone()
templateclone.Parent = NomGui
templateclone.Position = UDim2.new(0.5, -100, num, 0)
templateclone.Text = v.Name
templatecone.Name="Person"
templateclone.MouseButton1Click:connect(function()
PS(template.Text)
end)
num = num -0.1
end
end
game.Players:PlayerAdded:connect(function(player)
for i,v in pairs (NomGui:GetChildren()) do
if v.Name=="Person" then
v:Destroy()
end
end
Nominate()
end)
game.Players.PlayerRemoving:connect(function(player)
for i,v in pairs (NomGui:GetChildren()) do
if v.Name=="Person" then
v:Destroy()
end
end
Nominate()
end)
Remember, this is set up for a local script but if you have the game FE, that will lead you into a bit of trouble if you want to change a value or that player. But you can always use a RemoteFunction or a RemoteEvent.
1 comment
?