When touching safe zone GUI not popping up


local SafeZonePart = workspace.SafeZonePart
local SafeZoneGUI = game.StarterGui.ScreenGui.SafeZone

SafeZonePart.Touched:Connect(function(touching)
local humanoid = touching.Parent:FindFirstChild(“Humanoid”)
if humanoid then
SafeZoneGUI.Visible = true
end
end)

1 Like

Make a server script to serverscriptservice

local SafeZonePart = workspace.SafeZonePart

SafeZonePart.Touched:Connect(function(touching)
local humanoid = touching.Parent:FindFirstChild(“Humanoid”)
if humanoid then
local plr = game.Players:GetPlayerFromCharacter(touching.Parent)
plr:WaitforChild("PlayerGui").ScreenGui.SafeZone.Visible = true
end

There can be some errors i write this on mobile

its like this

write
end)
to last line this will work

Sorry, but what is a server script???

Server script is just script add to serverscriptservice not local

noooo

its

local SafeZonePart = workspace.SafeZonePart

SafeZonePart.Touched:Connect(function(touching)
local humanoid = touching.Parent:FindFirstChild(“Humanoid”)
if humanoid then
local plr = game.Players:GetPlayerFromCharacter(touching.Parent)
plr:WaitforChild(“PlayerGui”).ScreenGui.SafeZone.Visible = true
end
end)

Im bad at explaining

Its from quote thingu change it

You’re modifying the wrong GUI, you’re modifying the GUI that’s given to the user when reseting or entering the game, that’s why it’s called “StarterGui”. To fix this, you need to change the variable SafeZoneGui to game.Players.LocalPlayer.PlayerGui, not game.StarterGui. Imagine that PlayerGui is StarterGui, that’s it.

Fixed Variable: local SafeZoneGUI = game.Players.LocalPlayer.PlayerGui.ScreenGui.SafeZone

1 Like

My script will work too if you want local you can do this guys script

1 Like

Hey there! Here’s the working and slighly improved version of your script:

local SafeZonePart = workspace.SafeZonePart
local Players = game:GetService("Players")

SafeZonePart.Touched:Connect(function(touching)
	local humanoid = touching.Parent:FindFirstChild("Humanoid")
	if humanoid then
		local SafeZoneGUI = Players.LocalPlayer.PlayerGui:FindFirstChild("SafeZone")

		if SafeZoneGUI then
			SafeZoneGUI.Visible = true
		end
	end
end)

Hope this helps!