Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Why does this not work???

Asked by 10 years ago


Door = script.Parent local debounce = false function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end function onTouched(hit) if debounce == false then local human = hit.Parent:findFirstChild("Humanoid") if (human == nil) then return end local player = getPlayer(human) debounce = true if (player == nil) then return end local stats = player:findFirstChild("leaderstats") local sp = stats:findFirstChild("Shiny Objects") if sp == nil then return false end if (sp.Value >= 10) then sp.Value = sp.Value - 10 print("Enough Money") script.parent:remove() end end end
0
Do not, just DO NOT use :remove() anymore! Use :Destroy() instead. gskw 1046 — 10y

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

Please don't just post code, make sure you include any output, etc.

However, your problem is on line 29. 'parent' should be capitalized. Therefore, script.Parent:remove()

Ad

Answer this question