✓ Accepted answer
Hello.
The reason as to why you aren't seeing changes to the Frame text, is because you are changing the frame in the StarterGui, instead of the PlayerGui. The StarterGui is different compared to the PlayerGui for a very important reason. The StarterGui, as said in it's name, is what gives the player the Guis when they join, and the PlayerGui, also said in it's name, is the Guis present in the Player.
To make changes to the gui, you are required to change the gui from the PlayerGui instead. So with your script, assuming it's a serverscript, you need to get the player via the Touched function, simply done with a Players:GetPlayerFromCharacter(hit.Parent). We tend to use a hit function for the touched function, as it's used to define the player.
Now let's take your script and apply these changes:
local Players = game:GetService("Players")
local Part = script.Parent
Part.Touched:Connect(function(hit)
local Player = Players:GetPlayerFromCharacter(hit.Parent)
local PlayerGui = Player:WaitForChild("PlayerGui")
PlayerGui.ScreenGui.Frame.TextLabel.Text = "hellloooo"
end)
Hope this helps!
1 comment
A copy of all the stuff in StarterGui is copied into each player's PlayerGui container when they spawn. With this script, you're changing the base copy of the GUI, and not the GUI the player currently has.