local db = true script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if db == true then db = false local player = game.Players:GetPlayerFromCharacter(hit.Parent) player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 script.Parent.Parent.Parent.Model:Destroy() end end end)
error: 12:20:25.556 - Touched is not a valid member of Model
Change script.Parent to script.Parent.Part and use waitforchild just in case the leaderstats hasnt loaded yet
local db = true script.Parent.Part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if db == true then db = false local player = game.Players:GetPlayerFromCharacter(hit.Parent) player:WaitForChild("leaderstats"):WaitForChild("Coins").Value = player.leaderstats.Coins.Value + 1 script.Parent.Parent.Parent.Model:Destroy() end end end)