I want to make a system, inwhich you touch a part, and a GUI appears. (The part has no transparency, and has collisions off) and when you exit the part, the gui will disappear.
function appear() print("hi") end function disappear() print("bye") end game.Workspace.Features.Zones.zone_Airport.Touched:Connect(appear) game.Workspace.Features.Zones.zone_Airport.TouchEnded:Connect(disappear)
(Obviously I haven't set the GUI up yet)
Any help would be appreciated.
Server script:
local touched = game.ReplicatedStorage.TouchedEvent -- make a REMOTE function in replicated storage, if you use a different name change it here local touchended = game.ReplicatedStorage.TouchEndedEvent -- same as above function appear(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then -- if its a player local plr = game.Players:GetPlayerFromCharacter(hit.Parent) -- get player touched:InvokeClient(plr) -- invoke function end end function disappear(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then -- if its a player local plr = game.Players:GetPlayerFromCharacter(hit.Parent) -- get player touchended:InvokeClient(plr) -- invoke function end end game.Workspace.Features.Zones.zone_Airport.Touched:Connect(appear) game.Workspace.Features.Zones.zone_Airport.TouchEnded:Connect(disappear)
Local script:
local pgui = game.Players.LocalPlayer:WaitForChild("PlayerGui") local sgui = pgui:WaitForChild("ScreenGui") -- name of your screen gui local fgui = sgui:WaitForChild("Frame") -- name of the frame to appear local rep = game.ReplicatedStorage rep:WaitForChild("TouchedEvent").OnClientInvoke = function() -- touched event fgui.Visible = true -- make visible end rep:WaitForChild("TouchEndedEvent").OnClientInvoke = function() -- touchended event fgui.Visible = false -- make invisible end