How can I make a text button pop up for everyone after a player touches a brick?

I am making a game and I do not know how to make a text label pop up for every player in game after someone touches a part. This is for a game who touches something so it can warn each player by showing a text label visible to every player that a player got a certain thing. I have found nothing on YouTube or the Developer Hub. I have used events, but the events did nothing. The text label needs to continue to pop up everytime someone touches something and still has it, but the text label disappears after the player touches the thing, if the player dies then the label would disappear. I know sometimes that the text label doesn’t show up at certain times after a player touches something. But it is when the player is keeping it so that after she got the thing then the text label would be visible to all players for a short amount of times so all the players could know that she got the item. After the player dies, then the text label is still gone. I really need help with this because it is very important for the game I am making.

1 Like

Ok start by making a remote event in replicated storage. Then a script in starterpack and a server script in serverscriptstorage. Also put the guy in replicated storage.

Write in the script in starterpack .

local event = game:GetService("ReplicatedStorage").Event
local tocuhP = workspace.TocuhPart
local player = game.Players.LocalPlayer

touchP.Touched:Connect(function(hit, player)

    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)

    if player then

event.FireServer(player)

end
end)

Write this in the server script:

local event = game:GetService("ReplicatedStorage").Event
local gui = game.ReplicatedStorage.Gui

local cool = false

event.OnServerEvent:Connect(function(player, gui)

if cool = false then

local guiClone = gui:Clone()
guiClone.Parent = player.PlayerGui

else

--u can decide what u want here 

end
end)

That should be it. Let me know if u run into any errors.

1 Like

this could be a starting point for what you want

-- Script in ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local part = workspace.Part -- you must assign a part

local status = Instance.new("StringValue")
status.Name = "Status"
status.Value = "None"
status.Parent = ReplicatedStorage


local debounce = false
part.Touched:Connect(function (hitPart)
	local humanoid = hitPart.Parent and hitPart.Parent:FindFirstChild("Humanoid")
	if not debounce and humanoid and humanoid.Health > 0 then
		debounce = true
		
		status.Value = hitPart.Parent.Name .. " has touched the part."
		wait(3)
		status.Value = "None"
		
		debounce = false
	end
end)

--- LocalScript in StarterPlayerScripts

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui")
screenGui.Parent = PlayerGui
local frame = Instance.new("Frame")
frame.Parent = screenGui
local text = Instance.new("TextLabel")
text.Size = UDim2.new(0, 200, 0, 50)
text.Visible = false
text.Parent = frame

local status = ReplicatedStorage:WaitForChild("Status")
local onChangeStatus = function ()
	if status.Value == "None" then
		text.Visible = false
	else
		text.Visible = true
		text.Text = status.Value
	end
end
status:GetPropertyChangedSignal("Value"):Connect(onChangeStatus)
onChangeStatus()

1 Like

Spelling error on the line you put local touchP, it actually says “tocuhP”

Ok - I wrote it directly on the browser so that’s my excuse:)