My Problem is that when i spawn in, it spawns the chests, then I go up to the first one and it shows the gui. But when I walk Up To The Second Chest it does not show the gui for some reason but i can go back to the first chest and it will show the gui again.
First Chest: https://gyazo.com/ff7057c2c19c30ec3d8df1f56ee9038a
Second Chest: https://gyazo.com/6d4603721e8f8143cd7eede6d7bd78e1
Explorer Images: Chest Location Gui Location
Script:
local Chests = workspace.Chests
local Range = 10
local P = game.Players.LocalPlayer
local C = P.Character or P.CharacterAdded:Wait()
local Hb = game:GetService("RunService").Heartbeat
function Check()
for i,v in pairs(Chests:GetChildren()) do
if (v.Hitbox.Position - C.PrimaryPart.Position).Magnitude <= Range and not v.Openers:FindFirstChild(P.Name) then
local Pos = workspace.CurrentCamera:WorldToScreenPoint(v.Hitbox.Position)
script.Parent.Open.Position = UDim2.new(0,Pos.X,0,Pos.Y,0)
script.Parent.Open.Visible = true
else
if script.Parent.Open.Visible then
script.Parent.Open.Visible = false
end
end
end
end
workspace.Chests.ChildAdded:Connect(Check)
Hb:Connect(Check)
