So, I have a huge invisible brick with CanCollide off around an area, and it's supposed to show the player a gui while they're in that area. However, whenever someone else enters the area, it removes the gui for anyone currently in the area. Any help?
--Hide the indicator script.Parent.Transparency = 1 --The indicator was touched script.Parent.Touched:connect(function(touching) --Check if the part is part of a player local player = game.Players:GetPlayerFromCharacter(touching.Parent) if player then --If the gui doesn't exist, make the gui if player.PlayerGui:FindFirstChild("gangTurf") == nil then local gui = game.ServerStorage.GuiStore.gangTurf:Clone() gui.Parent = player.PlayerGui script.Parent.TouchEnded:connect(function(newTouch) --If the part that disconnected was from the receiving player, then remove the gui. --Prevents weird flashing of the gui. local checkPlayer = game.Players:GetPlayerFromCharacter(newTouch.Parent) if checkPlayer == player then gui:Destroy() end end) end end end)
while true do for i,v in pairs(game.Players:GetChildren()) do repeat wait() until v.Character if (v.Character.HumanoidRootPart.Position - game.Workspace["PART"].Position).magnitude <= 10 then --Put the distance from which the player should start seeing the GUI GUI.Visible = true end end wait() end
Make sure to run through my script for errors, and make sure to locate the GUI and part from where they are located in your editor.
I HIGHLY ADVISE YOU TO ASK ME ANYTHING IF YOU RUN INTO PROBLEMS!!!