Touched Character Help

Hello! I’m doing PVP for my upcoming game but when I touch a player with what is needed it also counts the accessory so it’s not getting what is touched and sometimes it does it correctly when not touching a accessory, just wanna know how do I make it count with touching the accessory and the normal meshparts of the player?

I ain’t showing any scripts to show because there isn’t really anything to show it’s simple to do what I just done.

Create a hitbox for your accessory

I diddn’t think about making a hitbox thanks I’ll go ahead and try it out.

By the way, if you don’t want to worry about multiple hits from body parts, just detect for a part named “HumanoidRootPart”. Will make your life easier.

Wait, I can’t make a hitbox it’s a normal player character not a NPC

Will go ahead and try this thanks!

You can create hitboxes in accessories, even when its a player

Can’t, It’s roblox avatar ones not custom made.

Learn how to do accessories, then you know how you can do hitboxes for them. In this case you would just replace the accessories with a changed copy of the original.

How would I do this? It’s a object I’m detected what touches it and it’s getting everything from the player so how would I make it count the “accessory.Parent.Parent” With the “Hit.Parent”?

Example:
accessory.Parent.Parent
Is
image

And
Hit.Parent
is
image

(rn im testing with npc’s but it’s going to be made for hitting real robloxians)

I’m sorry, I don’t really understand what you are trying to do.

Do you want it so that if a player touches an accessory on another player the player gets it?

No, It’s a throwing game and we throw stuff. I’m trying to do so if the Cloned Throwing Object hits a player it removes damage and stuff but It seems to be counting the accessory Meshpart / Part instead of the actual player meshparts

Oh, I see.

When the object hits the accessory:

shuriken.Touched:Connect(function(part)
	if part:IsA("BasePart") and part.Parent:FindFirstChild("Humanoid") then
		-- Remove the  player's part
	end
end)

Basically, this checks if the part is a direct child of the character.

Edit: Read your thing competley wrong ahha I will chec kinto this thanks.

No problem, also I edited it that’s why. (I misunderstood your post as well)

what I’m trying to do is get the player name every time a object touches the player would this do that?

It technically would. If you then use

local player = game.Players:GetPlayerFromCharacter(part.Parent)

Sorry if I misunderstand just let me know.

Omg I just thought of something… I can maybe turn off cantouch on accessorys parts with a script… I will do this then continue the conversation if this continues

Or you could just check the class of the parent of the touching part, if it’s “Accessory” then you can ignore the touch or perform some other action.

local part = script.Parent

part.Touched:Connect(function(hit)
	if hit.Parent:IsA("Accessory") then
		--ignore touch or do some other action
	end
end)