Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont this work?

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

2 comments

0

Is this inside a local or a normal script?

0

Normal

1 answer

g = game.Workspace.GuiGive2

Change this line to

g = game.Workspace["GuiGive2"]

2 comments

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.

0

Oh i just realised, you do know a playergui takes time to load after a player joins (for play mode), use waitforchild

This discussion is preserved as it was. New answers, comments, and votes are closed.