Why won't my script detect my part from my character?

When the part from the character touches the coin, the coin gives them their currency. But the coin will only look for the part and nothing else.



Coin script:

local part = script.Parent.Base -- it's the base part of the coin model!

	if hit.Name == "PlayerBall" then
		local character = hit.Parent.Parent -- the parent of the ball = the HumanoidRootPart, and the parent of HumanoidRootPart = the character
		local player = game.Players:GetPlayerFromCharacter(character)
		if player then
			player.leaderstats.Coins.Value += 1 -- add a coin to the player's coins value
			part::Destroy() -- destroy the coin part so it can't be collected again

I am not sure what you are asking, could you re-word it please? In the meantime make sure CanTouch is enabled on all parts

Basically this part:

is a child of the HumanoidRootPart in the players character.

when the players moves around with the part attached to them and that part touches the coin:

so when that part touches the coin, the part will detected it and will give the player the amount that is in the value which is in the coin.

It only “looks” for the ball because it only runs on the condition that the part’s name is PlayerBall. I don’t see what the issue is if this is intended behavior