Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this not work???



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

1 comment

0

Do not, just DO NOT use :remove() anymore! Use :Destroy() instead.

1 answer

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()

This discussion is preserved as it was. New answers, comments, and votes are closed.