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 9 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 — 9y
0
Normal teklain 0 — 9y

1 answer

Log in to vote
0
Answered by
samy22 10
9 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 — 9y
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 — 9y
Ad

Answer this question