Notification script not showing up on client when touched

  1. What do you want to achieve?
    What I wish to achieve is getting it to get visible and the text changes however, if I go to properties it shows it’s visible but isn’t visible for the player.

  2. Script is not changing TextBoxs text Include screenshots / videos if possible!

local changeColor = game.Workspace.LOl
local notification1 = game.StarterGui.ScreenGui.TextBox
game.Workspace.Part.Touched:Connect(function(hit)
	for pod1 = 10,0,-1 do
		notification1.Visible = true
		game.StarterGui.ScreenGui.TextBox.Text = "Brick Touched!"
		wait(1)
		notification1.Text = pod1
	end
end)

You have to make the gui appear by playerGui not starterGui

Ex:

game.Players.LocalPlayer.PlayerGui.ScreenGui.TextBox.Text = "Brick Touched!"
1 Like

Good effort – but you fell into the trap that everybody does when they first try something like this!

The StarterGui is not live-updating. If you change it, people won’t see that change until they respawn, at which point roblox copies the contents of the StarterGui into that Player’s PlayerGui.

What you actually should do is:

  1. Get the actual Player object that touched your part
  2. Change the TextBox inside that Player’s PlayerGui instead of the ScreenGui.
1 Like

Thanks! It’s only my 2nd day of scripting and I thought it was something on my side that I did wrong. Anyways once again thank you!

Thanks for the help it worked, my 2nd day of scripting thought it was something on my side.

I added that line of code and didn’t work when I pressed play, but when I put it in the output it worked? any solution to fix this?

local changeColor = game.Workspace.LOl
local notification1 = game.Players.LocalPlayerPlayerGui.ScreenGui.TextBox
workspace.Part.Touched:Connect(function(hit)
	for pod1 = 10,0,-1 do
		notification1.Visible = true
		game.Players.PlayerGui.ScreenGui.TextBox.Text = "Brick Touched!"
		wait(1)
		notification1.Text = pod1
	end
end)

game.Players.PlayerGui isn’t a thing, you need an actual player.

And game.Players.LocalPlayer.PlayerGui would only work from a LocalScript, which is not what this is.

You need to find the player attached to the part that hit you. Something like this:

game.Workspace.Part.Touched:Connect(function(hit)
    if hit.Parent:IsA("Model") and hit.Parent:FindFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player then
            -- use player.PlayerGui instead of game.StarterGui here!
        end
    end
end)

It is supposed to be a local script because he only wants that player to see the gui