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

Deleting a part with a text button?

Asked by 4 years ago
Edited 4 years ago

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

0
Check output SoftlockedUnderZero 668 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

: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!

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! NnIgHtMaRe0 0 — 4y
0
No problem! killerbrenden 1537 — 4y
0
Hmm actually I tried it, and it still won’t work. Aaaaa NnIgHtMaRe0 0 — 4y
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 NnIgHtMaRe0 0 — 4y
0
Is there something in the workspace with the exact name of "AmethystBubble"? killerbrenden 1537 — 4y
Ad

Answer this question