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

how to make if player added function in startergui ?

Asked by
mehssi 20
9 years ago

hi can you help me add a 'if player added' function to this script? I know it should be something like this but idk how it should be in startergui please help me game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Char)

-- need help here
local Torso = player.Character.Torso
local BackGui = Instance.new("SurfaceGui",Torso)
BackGui.Face = "Back"
BackGui.CanvasSize = Vector2.new(100,100)
local NameDisplay = Instance.new("TextLabel",BackGui)
NameDisplay.Size = UDim2.new(0.6,0,0.6,0)
NameDisplay.Position = UDim2.new(0.21,0,0.28,0)
NameDisplay.BackgroundTransparency = 1
NameDisplay.FontSize = 5
NameDisplay.TextStrokeTransparency= 0
NameDisplay.Text = player.hiddenstats.Jersey.Value
NameDisplay.TextColor3=Color3.new(1,1,1)
NameDisplay.TextScaled = true
NameDisplay.TextWrapped = true

player.hiddenstats.Jersey.Changed:connect(function()
    NameDisplay.Text = player.hiddenstats.Jersey.Value
end)

1 answer

Log in to vote
1
Answered by
Kyokamii 133
9 years ago

it would be game.Players.PlayerAdded:connect(function(Player)) the other one you said will only activates IF the character loads.

Ad

Answer this question