Oxygen system breaks after player respawns

I’m trying to make an oxygen/drowning system, and after the player dies or respawns it stops working. Sometimes, it doesn’t even work at all… I’m still fairly unskilled to scripting and I’m trying to find ways to use ZonePlus. If someone could help me, that would be great. Thank you.

oxygen system breaks after respawning, sometimes doesnt work at all.rbxl (87.0 KB)

3 Likes

It’s probably because you are saving the character / humanoid in a variable but not changing the variable when the player dies. Hence the variable becomes nil and doesn’t work

2 Likes

I have ResetOnSpawn = true for the oxygenGui object, which contains the LocalScript

Set it to false then, that’s probably the issue.

1 Like

How would this solve what @Orbular3 said? I want it to reset when the player respawns, and it does, but it just breaks.

I’ll take a look at the file rq.

1 Like

Does your script use the player’s character or humanoid at all or is it just the GUI that’s faulty? Because if so then just set ResetOnSpawn to false

Sticking in some print statements shows that when you reset your character and have the GUI as ResetOnSpawn = true, the zone detection doesn’t (re)connect correctly.
Turning it off solves the issue as it isn’t disconnected on respawn.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.