How to make a text appear when a player touches a part

Hey reader! I’m trying to make it so that when the player touches a part something like this will appear on the screen for about 5 seconds


If you know how to make something like this, please let me know!

1 Like

put this in startergui***

local Player = game.Players.LocalPlayer

    local function OnTouch()

    Player.PlayerGui:FindFirstChild("GuiNameHere").Enabled = true -- change both names to ur gui name

    wait(5)

    Player.PlayerGui:FindFirstChild("GuiNameHere").Enabled = false

    end

game.Workspace:FindFirstChild("PartNameHere").Touched:Connect(OnTouch) -- make sure its in workspace or edit it
4 Likes

Thanks a ton! This will make the player more immersed! Thanks again!

1 Like

Sorry I’m a late but you can actually save time if you instantly connect the function like this:***
local Player = game.Players.LocalPlayer
game.Workspace:FindFirstChild(“Part”):Connect(function(OnTouch)

Player.PlayerGui:FindFirstChild("GuiNameHere").Enabled = true -- change both names to ur gui name

wait(5)

Player.PlayerGui:FindFirstChild("GuiNameHere").Enabled = false

end)

1 Like