You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Change text to = a points value
What is the issue? Include screenshots / videos if possible!
Workspace.CurrentFloor.Scoreboard.ScoreboardUI.BG.ListLayout.Example.Info.Points.Script:8: attempt to index nil with ‘Points’ - Server - Script:8
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Devfourms
local Players = game:GetService("Players")
local playerName = script.Parent.Parent.PlayerName
for i, player in Players:GetPlayers() do
while true do
task.wait()
if script.Parent.Parent.Parent.Parent.Parent.Parent.Players:FindFirstChild(playerName):FindFirstChild("Points") then
script.Parent.Text = tostring(script.Parent.Parent.Parent.Parent.Parent.Parent.Players:FindFirstChild(playerName).Points.Value)
else
warn("nope, fix me")
end
end
end
Yes im aware the code is horrific, im trying to get the code to work before i improve on how it looks
local playerName = script.Parent.Parent.PlayerName
while task.wait() do
local playerB = game:GetService("Players"):FindFirstChild(playerName)
local Points = (playerB and playerB:FindFirstChild("Points"))
if Points then
script.Parent.Text = Points.Value
else
warn("nope, fix me")
end
end
Sorry, got sidetracked while I wrote this so some of it’s been covered.
Your while true loop never ends so it’s only seeing the first player, not all of them.
Print things like player after setting it to see if it matches what you expect it to.
Players is a service so don’t go through all that Parent.Parent stuff. You may just have one too many or to few .Parents in your code.
If you print your variables instead of just ‘nope didn’t work’ it’ll help you troubleshoot.