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

Why wont this work?

Asked by 10 years ago
local g = game.Workspace.GuiGive2

while true do
    for i,v in pairs(game.Players:GetChildren()) do
        if (v.Character.Torso.Position - g.Position).magnitude <= 10 and    v.PlayerGui.Teleport.Game.Visible == false then
                v.PlayerGui.Teleport.Game.Visible = true
        end
        if (v.Character.Torso.Position - g.Position).magnitude >= 10 and v.PlayerGui.Teleport.Game.Visible == true then
            v.PlayerGui.Teleport.Game.Visible = false
        end
    end
wait()
end

It's suppose to work so when someone comes near the brick it shows a gui

0
Is this inside a local or a normal script? gskw 1046 — 10y
0
Normal teklain 0 — 10y

1 answer

Log in to vote
0
Answered by
samy22 10
10 years ago

g = game.Workspace.GuiGive2

Change this line to

g = game.Workspace["GuiGive2"]

0
It works in play solo mode with g = game.Workspace["GuiGive2"] and g = game.Workspace.GuiGive2 but still doesn't work in Play mode. teklain 0 — 10y
0
Oh i just realised, you do know a playergui takes time to load after a player joins (for play mode), use waitforchild samy22 10 — 10y
Ad

Answer this question