SurfaceGui TextLabel Error

Hey there!

So i was testing this simple script but for some reason the script cannot seem to find the TextLabel.

Here’s the script:

local Paper1 = script.Parent:WaitForChild("Paper1")

game.ReplicatedStorage.IntermissionPlayerPfp.OnServerEvent:Connect(function(plr)
	print("Test")
	if Paper1.IsPlayer.Value == false then
		Paper1.Name.SurfaceGui.TextLabel.Text = plr.Name
		Paper1.Name.SurfaceGui.Enabled = true
	end
end)

Here’s the output:

image

Here’s the layout:

image

Any help would be greatly appreciated :+1:

Rename the part “Name” to something else or use :WaitForChild(“Name”). The script is trying to access SurfaceGui as a child of the part’s name property.

I changed the name of the part to “childPart” and everything worked fine.

local Paper1 = script.Parent:WaitForChild("Paper1")

game.ReplicatedStorage.IntermissionPlayerPfp.OnServerEvent:Connect(function(plr)
	print("Test")
	if Paper1.IsPlayer.Value == false then
		Paper1.childPart.SurfaceGui.TextLabel.Text = plr.Name
		Paper1.childPart.SurfaceGui.Enabled = true
	end
end)
1 Like

because it confusing the part “Name” with the Name propertie. so that means it looking into Paper1’s Name and of course it cant fin the textbox. I recommend changing the part “Name” name to something different

2 Likes