Why does this error seem to happen?

I created a code whereas the player can spawn in a type of accesory and script put inside their character model on them with the click of a button, then when the button is pressed while that accesory is on them and the script is inside their character model, i want them both to be destroyed but instead i get this error
Screenshot 2024-08-11 172157
this is the server script for it


and this is where the scripts and accesory come from in replicated storage
Screenshot 2024-08-11 172230
Screenshot 2024-08-11 172237

You passed an Instance to FindFirstChild however FindFirstChild expects a string.

Instead of

local bike = char:FindFirstChild(ChosenCart)

try

local bike = char:FindFirstChild(ChosenCart.Name)

same goes for the ChosenAbility as well:

local ability = char:FindFirstChild(ChosenAbility.Name)
1 Like

The script works now thanks to your advice :+1:

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