function showgui(part)
local player = game.Players:playerFromCharacter(part.Parent)
if part.Parent:findFirstChild("Humanoid") and player then
if not player.PlayerGui:findFirstChild("Message") then
local message = game.Lighting.Message:clone()
message.Parent = player.PlayerGui
end
end
end
script.Parent.Touched:connect(showgui)
How do I let the gui get removed when the player stop touching the brick? I used:
if player == nil then
local delete = player.PlayerGui
delete.Message:remove()
but it did not work |