I’m trying to make a player position bar, much like Tower of Hells, but the code I made doesn’t work. In fact, it doesn’t seem to do anything to the cloned abject at all
code:
local bar = script.Parent.Bar
local plrFrame = script.Parent.Plr
local playerservice = game:GetService("Players")
local endpoint = game.Workspace.EndCFrame
task.wait(1)
local function update()
local plrs = playerservice:GetChildren()
for _, v in ipairs(plrs) do
local plrposition = v.Character.HumanoidRootPart.Position
local clone = plrFrame:Clone()
clone.Visible = true
clone.Parent = script.Parent.clones
local mag = (plrposition - endpoint.Position).Magnitude
print(mag)
clone.Position = UDim2.fromScale(math.ceil(mag)/1000, 0.9)
clone:Destroy()
end
end
while task.wait(0.1) do
update()
end
local bar = script.Parent.Bar
local plrFrame = script.Parent.Plr
local playerservice = game:GetService("Players")
local endpoint = game.Workspace.EndCFrame
task.wait(1)
local cachedFrames = {}
local function update()
local plrs = playerservice:GetChildren()
for _, v in ipairs(plrs) do
if cachedFrames[v.UserId] then cachedFrames[v.UserId]:Destroy() end
local plrposition = v.Character.HumanoidRootPart.Position
local clone = plrFrame:Clone()
clone.Visible = true
clone.Parent = script.Parent.clones
local mag = (plrposition - endpoint.Position).Magnitude
print(mag)
clone.Position = UDim2.fromScale(math.ceil(mag)/1000, 0.9)
cachedFrames[v.UserId] = clone
end
end
while task.wait(0.1) do
update()
end
Oh wait, so your code doesn’t work to begin with?
We can’t just fix it without knowing the context of what a PlayerFrame is, and what your project’s hierarchy looks like.
EDIT:
You will need to provide more details explaining better what your project looks like, what you have already done and exactly what is the result you want.
Alternatively you can also share the roblox place if it’s not private, so that I can edit it on the spot.
Well, can you explain if you see anything? How does the bar look like? Is it vertical, is it horizontal??
What is a plrFrame in this context?
Where is this script Parented to?