How do i detect whether or not a accessory is attached?

I am making a script, but some accessories can’t attach to the wanted area and they just fall on the ground and don’t attach to the player.

How do I detect if a accessory is attached to something or not?

2 Likes

I’m sorry if I didn’t understand but what are you trying to do more or less exactly or why do you want to know that?

3 Likes

Simple, how do I detect whether or not a accessory is attached to something or if it is not. As in the title.

2 Likes

as far as i know when a player joins they always have the props attached to their head.

2 Likes

Nononono lol I’m asking if you don’t have a head but you have a back. I don’t want to completely leak my game but like just how do I detect if a accessory is attached that is my question.

2 Likes

When an accessory is attached, a Weld gets parented to its Handle.

The best practice would be to chain-check its descendants like this:

local Handle: BasePart? = Accessory:FindFirstChildWhichIsA("BasePart")
local AccessoryWeld: Weld? = if Handle then Handle:FindFirstChildWhichIsA("Weld") else nil

if Handle and AccessoryWeld then
	...
end
2 Likes

Better question, how do I detect a accessory type?

1 Like

I think it is as simple as I check if the accessory’s handle has a ‘AccessoryWeld’. Thank you so much!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.