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

Whats wrong here?

Asked by 10 years ago

This script does not seem to function correctly. It only puts on player in a slot and no one else. It's supposed to get all the players on a specific team color and put them into random slots in imagelabels once so that all the players on that team are in an image label value. Can someone help me??

local labels={[1] = script.Parent.Parent.BackFrame.Frame.PlayerSpot}
local count=1
wait(0.5)
--print(labels, count)
for _,v in pairs(game.Players:GetPlayers())do
if v.TeamColor==BrickColor.new'Bright blue'and labels[count]then
labels[count].PName.PlayName.Value=v.Name
table.insert(labels,count,v.Name)
count=count+1
end
end

1 answer

Log in to vote
0
Answered by 10 years ago

To my eyes

[1] = script.Parent.Parent.BackFrame.Frame.PlayerSpot -- The [1] is not needed

For tables with multiple instances do and these order like this when you table.insert

local labels = {script.Parent.Parent.BackFrame.Frame.PlayerSpot, 2nd object, 3rd object, 4th object}

to fetch these values do

labels[count]
0
It won't work without a [1]. The image labels are all named the same. billybobtijoseph 1 — 10y
0
Then rename them, That's your error. When you try to call the label then your script calls every single label because they are all named the same NovusTheory 133 — 10y
Ad

Answer this question