So what I want this script to do is that when they click the button their right arm comes off. But for some reason it doesn't' delete the arm.
local button = script.Parent function onClick(part) local Player = script.Parent:FindFirstChild("Humanoid") if Player then local darm = button:FindFirstChild('Right Arm') darm.Remove end end script.Parent.ClickDetector.MouseClick:connect(onClick)
Please help me.
Your problem is that you're trying to get the player incorrectly, and you're not destroying it properly. For ClickDetectors, the argument that the function provides, is the player who clicked. So all we need to do, is set that and use it.
The code should look like this:
function onClick(Player) --Code end script.Parent.ClickDetector.MouseClick:connect(onClick)
So now that we have that set up, we just need to get the players character, then remove the arm.
function onClick(Player) if Player then local darm = Player.Character:FindFirstChild('Right Arm') darm:Destroy() --You should use the :Destroy() instead of :remove(). Remove is disambiguate. end end script.Parent.ClickDetector.MouseClick:connect(onClick)
So now your script should work correctly. If you have any further problems/questions, please leave a comment below, and I'll see what I can do. Hope I helped :P