Why I can't turn the property of my script "Disabled" false?

I want to make the “Remove” script active when it hits the ground, so my place won’t be cluttered. Here is the script that tries to change the property.

function playSound()
local sounds = script.Sounds:GetChildren()
local randomsound = math.random(1, #sounds)
local sound = sounds[randomsound]
if sound ~= nil then
       sound:Play()
	end
end

script.Parent.Touched:Connect(function()
	script.Parent.Remove.Disabled = false -- Here is the line of code that  changes the property.
	playSound()
end)

This line won’t work because when you do script.Parent.Remove you’re actually trying to access the deprecated Instance:Remove function. Renaming this to Delete or similar will solve this problem.

2 Likes

The “Remove” is the name of the script.

See:

Your code does not work.

1 Like

So should I change the name of the script?

Yes. That is precisely what I told you to do.

Please read before posting.

1 Like

Sorry, sometimes I miss things. Thanks!