Player Information when Touching a Part

Hello everyone! Today I was trying to make a “Scan System”, the Scan System should work the following way:

  • Player touched the part
  • The script inside the part takes the nametag information of the player
  • The information appears in a SurfaceGui

The NameTag of the Player contains; the name of the player and its role.

I’ve tried many ways of doing this, but none of them worked, so if anyone knows and could help me I’d really appreciate!

Here are some pictures

image

image

Thank you!

PS: Im not a scripter, so my scripting knowledge is poor

1 Like
local db = false
script.Parent.Touched:Connect(function(touched)
	if touched.Parent:IsA("Model") and touched.Parent:FindFirstChild("Humanoid") and not db and touched.Parent.Head:FindFirstChild("Nametag") then
		db = true
		script.Parent.Parent.Display.Surfacegui.Rank.Text = touched.Parent.Head.Nametag.Rango.Text
		db = false
	end
end)

Eh I think you want to do something like this, put this in that InfoHandler script, not sure if debounce is really needed :smiley:

Hope it works

where is the billboardgui “nametag” located?
I need a wider print

I’m going to pretend it’s located on the player’s head.

here is the code:

Code.txt (519 Bytes)

Sorry for the late response, yes, the NameTag is located in the Player’s Head

I’ve tried, it doesnt work, I dont see any related error in the output

Is the door CanCollide? If it isn’t then I think it wont work

The door has the CanCollide propertie OFF (we can go through)

Well that changes it, my bad for not thinking about it earlier, I’ll try fix

Be more specific with the error

Actually not sure why it wouldn’t work

already managed to resolve the error?