I have a clone script in ServerScriptStorage and then I have a part in ServerStorage. The script in ServerScriptStorage is a clone script that clones the part in ServerStorage
This is the script in a ClickDetector and its parent is the part so part to ClickDetector to script
The error in the output says "Destory is not a valid member of Part" error on: Script 'Workspace.GrassBox.ClickDetector.Script', Line 7 This has been cloned to workspace
wait(0.5) local grassbox = game.Workspace:WaitForChild("GrassBox") function Clicked(Plr) Plr:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value = Plr:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value + 1 wait(0.1) grassbox:Destory() end script.Parent.MouseClick:connect(Clicked)
basically problem is grassbox:Destroy() but I don't know how to fix
Here is your revised script. Also I just wrote it in a more efficient way in my opinion. Hope it works! If not let me know.
wait(0.5) local grassbox = game.Workspace:WaitForChild("GrassBox") script.Parent.MouseClick:connect(function(clicked) local chr = clicked.Parent local plr = game.Players:GetPlayerFromCharacter(chr) if plr:FindFirstChild("leaderstats") then if plr.leaderstats:FindFirstChild("GrassTokens") then plr.leaderstats.GrassTokens.Value = plr.leaderstats.GrassTokens.Value + 1 end end wait(0.1) grassbox:Destroy() end)