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

Deleting a part with a text button?

So I’m trying to do this:

script.Parent.MouseButton1Click(fuction()
game.Workspace.AmethystBubble:Delete()
end)

But it doesn’t seem to be working, and I’m not sure why. I’ve also tried

scrip.Parent.MouseButton1Click(function()
game.Workspace.AmethystBubble.Transparency = 1
end)

Yet it still won’t work. What am I doing wronggg

1 comment

0

Check output

1 answer

✓ Accepted answer

:Delete() is not a ROBLOX function. There is only one functions to destroy something, and that's :Destroy() as :Remove() is deprecated.

So, your script should look like this.

script.Parent.MouseButton1Click:Connect(function()
	game:GetService("Workspace"):FindFirstChild("AmethystBubble"):Destroy()
end)

If you are calling this from a LocalScript, only the client will see this, not the server. So, not everyone will see this happening.

If you want the server to see this, I recommend using a ServerScript.

Hope this helped! If this answered your question, don't forget to select this as the answer!

5 comments

0

Oops I did actually put Destroy(), I just put delete on here. I’m using a normal script as well, which I probably should change lol. Thank you!

0

No problem!

0

Hmm actually I tried it, and it still won’t work. Aaaaa

0

I do have a second script on it that makes the whole frame invisible after clicking, but I’m not sure if that affects it

0

Is there something in the workspace with the exact name of "AmethystBubble"?

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