Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Can I print, where an item is located in workspace?

So basically, let's say when I hit a part, and its my right leg, is there a way i can make it print the location, eg:

OUTPUT: game.Players.PlayerName.Humanoid.RightLeg

1 comment

0

You can try :GetFullName()

3 answers

✓ Accepted answer

supa dupa simple

script.Parent.Touched:Connect(function(hit)
	print(hit:GetFullName())
end)

1 comment

0

Thanks, also thnx to others for trying to help, i accepted ur answer as you provided an example

Try this: Parent the script under the detection part

local detectPart = script.Parent

detectPart.Touched:Connect(function(part)
	if part then
		if part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid") then
			
			print(part.Position)
		end
	end
end)

1 comment

0

I don't understand how the part's parent's parent could be the player's character. Other than that, I agree with your answer.

Really easy to do! This script that I made down below checks if whatever touches the part is a humanoid (player) and prints what has touched the part.

script.Parent.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
        print(hit.Name .." has touched the part") 
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.