I'm trying to make a radar that shows the positions of all the players and some other humanoid models that I have in a table. This script correctly shows trackers for all the characters that I want, but doesn't position them all properly - only one or two are correct and the others are all placed at (0,0). Does anyone know why this is happening? FilteringEnabled is true. I previously tried waiting for the character's Torso, but it wouldn't find the torso, even though it existed (I'm not sure why this is happening either).
function updateTracker(v)
local newt = tracker:Clone()
newt.Visible = true
newt.Parent = frame
newt.Name = v.Name
if v:FindFirstChild("Humanoid") then
v.Humanoid.Changed:connect(function()
if not v:FindFirstChild("Humanoid") or v.Humanoid.Health < 0 then newt:Destroy() end
end)
end
if v:FindFirstChild("Smashable") then
newt.BackgroundColor3 = Color3.new(0,180/255,0)
else
newt.BackgroundColor3 = Color3.new(0,50/255,1)
end
if game.Players.LocalPlayer.Name == v.Name then
frame[v.Name].Size = UDim2.new(0,9,0,9)
end
frame[v.Name].Position = UDim2.new(0, -(v:GetModelCFrame().p.X)/4 + 50, 0, -(v:GetModelCFrame().p.X)/4 + 50)
end
Currently this is looping once every second through a table of players and a table of the other Humanoid models.
--MightyWanderer

1 comment
To wait for a torso, do character:WaitForChild("Torso")