"game.Workspace.[Partname]:Destroy()" script not working

So I have a part, which activates an event, which then activates a GUI to pop up, which has dialouge. After the dialouge is done, the GUI dissapears. At the end of the script I put:

game.Workspace.PopupActivate3:Destroy()
script.Parent.Enabled = false

So after the dialouge is done, the GUI dissapears, as it should be… Except for when the player dies, or resets their characters, or touches the part again, the part (I assume) does not dissapear as then the GUI appears back on the players screen and stays there, and does not dissapear, yet I added a destroy script at the end of the script for the GUI, and I made it to disable the GUI.

I added another part farther in the map which has the same thing as the first:
game.Workspace.PopupActivate3:Destroy()
so there’s another script that destroys the trigger part, but the same thing happens…

Why isn’t the destory part & disable the GUI script not working? How can I fix this?

1 Like

If you’re destroying it from the client, it still exists on the server

1 Like

Then how do I make it where it deletes itself only for the player who touched it? Would I have to change it to a local script?

Yes, localscripts only operate for the local player aka you. But if you have something on the server that handles it, you’d have some conflicts between the server and the client.

Also keep in mind these are the only places that local scripts operate:
image

2 Likes

Well, I tried that… but it still doesn’t work…

The scripts I use work in another “place” of my game. They work normally, however I am having all of the issues in this place of my game.

I checked all of the scripts, and both are exactly the same. One of them works in the other place, while this one doesn’t.

And I figured out that the part does get destroyed… but the GUI still appears… even though I can see the part being destroyed…

1 Like

Can you link the game(s), please?

1 Like

Well, the game isn’t released… I can send you what the scripts look like though,

1 Like

Is the ResetOnSpawn property of the screen gui false?

Yes, it is set to false. And I even tried it when I set it to true, and it still didn’t work.

What type of event is that? Maybe I can help you a bit further.

Edit: What type of part activates the event exactly? Is it a proximpty prompt, Click Detector or Touched?

1 Like

Umm… well, “ResetOnSpawn” was always set to false… but then I changed it to true, and it still didn’t work… and then when I put it to false again, it now works…

I honestly have no idea why it didn’t work before… but

Thank you!

It was a remote event.

Actually, the problem is now solved. The problem was with “ResetOnSpawn.”

I had “ResetOnSpawn” set to false…and it didn’t work. So I then changed it to true, and it still didn’t work… But when I changed it back to false it then did work.

I don’t really know why it broke and didn’t work, even though I had it to false before… but now the problem is solved.

So I don’t really need help anymore,

thank you though!

Your welcome, I was going to say that.

1 Like

Andddd I spoke too soon… :confused:

It’s now broke again. Seriously, I swear it was working before. Now it went back to it being broke and not working again.

I seriously don’t know what the problem is with this. The dialouge/gui system I have in another place works fine, while in this one it doesn’t…

I don’t know if this matters, but I got some weird errors in the console:
(I don’t think the top errors are realevent. I think only the stuff from “StackBegin” to “Line 115”)
image

I think you need to put the remote event into replicated storage? I’m not a genius of events, but this is all I can know.

Oh, sorry. I’m all mixed up. I don’t think any of those errors are realated to the GUI I don’t think…

So the events were in (and still are) in ReplicatedStorage…

What are you using exactly to make the event happen? Is it a proximty prompt, click detector or touched?

An OnTouched:

Here is the script that triggers the event:

Hey, sorry for the late response, may I see the OnClient script? And the first script you showed me is correct as it should be.

Sure, here it is: