✓ Accepted answer
wrong, this is a very common mistake which a lot of people edits screengui, yeah that works before but it's moved to playergui (located inside game.Players.LocalPlayer)
you are going to do:
local Part = script.Parent
Part.Touched:Connect(function(hit)
if hit.Parent.Name == game:GetService("Players").LocalPlayer.Name and hit.Parent:FindFirstChild("Humanoid") then
local Character = hit.Parent
local PlayerGui = game:GetService("Players").LocalPlayer.PlayerGui
PlayerGui:WaitForChild("ScreenGui").TextLabel.Text = Character.Name
end
end)
3 comments
this might be a little confusing but in the if-then statement, i have made two statements, the first one is what i changed, it detect if the touched player name is equaled to localplayer name
the reason i located playergui is because script too long lol
thanks it works!