So basically i’m trying to make a minimap and let the client see the distance,but idk why it just doenst work,any ideia why? heres my code:
local showdistance=true
local islands = {
["Ghost Town"] = Vector3.new(-200, 13, -4600),
["Joruto"] = Vector3.new(-7001, 5, -5392),
["Maka"] = Vector3.new(-4400, 7, -2500),
["Colosseum"] = Vector3.new(-2000, 7, -7700),
["Spawn"] = Vector3.new(1060, 9, 1200)
}
for i,v in next,islands do
part = Instance.new("Part")
part.Transparency=1
part.Name = i
part.Anchored=true
part.Position = v
part.Parent=game.workspace
local BillboardGui = Instance.new("BillboardGui")
local TextLabel = Instance.new("TextLabel")
local UIListLayout = Instance.new("UIListLayout")
BillboardGui.Parent = part
BillboardGui.AlwaysOnTop = true
BillboardGui.LightInfluence = 1
BillboardGui.Size = UDim2.new(0, 80, 0, 20)
BillboardGui.StudsOffset = Vector3.new(0, 120, 0)
UIListLayout.Parent = BillboardGui
TextLabel.Parent = BillboardGui
TextLabel.BackgroundTransparency = 1
TextLabel.Size = UDim2.new(0, 80, 0, 10)
TextLabel.Text = i
TextLabel.TextColor3 = Color3.new(1, 1, 1)
TextLabel.TextSize = 10
if showdistance==true then
print("yes")
TextLabell = Instance.new("TextLabel")
TextLabell.Parent = BillboardGui
TextLabell.BackgroundTransparency = 1
TextLabell.Size = UDim2.new(0, 80, 0, 10)
TextLabell.TextColor3 = Color3.new(1, 1, 1)
TextLabell.TextSize = 9
TextLabell.Position = UDim2.new(0, 0, 0.5, 0)
local posicaoplayer = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
local distanciax = posicaoplayer.X - v.X
local distanciaz = posicaoplayer.Z -v.Z
print(distanciax)
print(distanciaz)
distanciafinal = math.sqrt(distanciax*distanciax+distanciaz*distanciaz)
print(distanciafinal)
while true do
wait()
TextLabell.Text= tostring(distanciafinal)
end
print("working")
end
end
print("test")