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

I cant get a text label via the player gui?

Asked by 3 years ago

Im trying to make a hide and seek game and i cant get the gui via player gui (sorry if i dont fully understand player gui im new) the code is

local player = game.Players.LocalPlayer
local allplyrs = game.Players:GetPlayers()

-- local seeker = allplyrs[math.random(1, #allplyrs)]
local seeker = table.remove(allplyrs, math.random(1, #allplyrs))
local sc = seeker.PlayerGui:WaitForChild("ScreenGui")
local tl = sc:WaitForChild("TextLable", 30)

tl.Text = "You are: Seeker"

and the error is: "  20:34:42.323 Players.cjkizzy286.PlayerGui.ScreenGui.TextLabel.Teamsetter:9: attempt to index nil with 'Text'  -  Client  -  Teamsetter:9"

you can see where the script is via error

and finally its a local script

also how would i get the seekers character cjkizzy286 40 — 3y
i also tried the comment (same error) cjkizzy286 40 — 3y
I think you misspelled "TextLabel" TheB4dComputer 100 — 3y
oh cjkizzy286 40 — 3y
oof cjkizzy286 40 — 3y

1 answer

Log in to vote
Answered by 3 years ago

To get a player's character from a localscript, you would have to use player.Character


Answer this question