You mentioned that it was a regular script in a Frame...
Before I share my answer I'll share with you an experience i had with doing the same thing:
When I click on a part, a gui (The frame) is supposed to pop up... however it pops up only ONCE. After I closed it, it never pops up again. I think the logic is the same behind this.
Therefore, I used RemoteEvents
and put the script in a local script instead, and it worked perfectly fine after that.
I have a way out here that (possibly) works
[[EDIT]]after the comments:
you mentioned that the real problem is really only about the Gui and the transparency not working.
that is because your old script was a Server-sided script inside a Frame. This cannot be used to change the transparency of the frame, as changing the transparency of a Frame would require a LocalScript. That's why we use the RemoteEvents to detect whether the oxygen breaking etc. changed
this is the server sided script in the workspace
01 | local OxGenPlrDying = workspace.OxGenPlrDying |
02 | local OxGenIsOnAction = workspace.OxGenIsOnAction |
03 | local OxGenPlrHealing = workspace.OxGenPlrHealing |
04 | local RE = game:GetService( "ReplicatedStorage" ).RemoteEvent |
05 | OxGenPlrDying:GetPropertyChangedSignal( "Value" ):Connect( function () |
06 | RE:FireAllClients(OxGenPlrDying.Value,OxGenIsOnAction.Value,OxGenPlrHealing.Value) |
07 | OxGenIsOnAction:GetPropertyChangedSignal( "Value" ):Connect( function () |
08 | RE:FireAllClients(OxGenPlrDying.Value,OxGenIsOnAction.Value,OxGenPlrHealing.Value) |
09 | OxGenPlrHealing:GetPropertyChangedSignal( "Value" ):Connect( function () |
10 | RE:FireAllClients(OxGenPlrDying.Value,OxGenIsOnAction.Value,OxGenPlrHealing.Value) |
The local script in the frame:
01 | local function changeBackgroundTransparency(your_parameters) |
05 | if game.Workspace.OxGenPlrDying.Value = = true then |
06 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency- 0.0001 |
07 | if game.Workspace.OxGenRestartComplete.Value = = true then |
08 | game.Workspace.OxGenPlrDying.Value = false |
09 | game.Workspace.OxGenPlrHealing.Value = true |
11 | elseif game.Workspace.OxGenPlrHealing.Value = = true then |
12 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency+ 0.01 |
13 | if script.Parent.BackgroundTransparency = = 1 then |
14 | game.Workspace.OxGenPlrHealing.Value = false |
18 | until script.Parent.BackgroundTransparency = 1 |
23 | RE.OnClientEvent:Connect( function (your_parameters) |
24 | changeBackgroundTransparency(your_parameters) |
So the logic here is that when oxygen level change, you fire the remote event which triggers the background transparency. it'll keep repeating the decrease/increase of background transparency until it gets the desired level.
i hope this was what you meant by your main problem
[ EDIT 2 ]
This is the first script, local script in the frame
01 | local RE = game:GetService( "ReplicatedStorage" ).RemoteEvent |
02 | local function changeBackgroundTransparency(OxGenPlrDying,OxGenRestartComplete) |
04 | if OxGenPlrDying = = true then |
06 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency- 0.0001 |
07 | if OxGenRestartComplete = = true then |
08 | OxGenPlrDying.Value = false |
10 | elseif OxGenPlrDying = = false then |
11 | print ( "Player Healing" ) |
12 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency+ 0.01 |
13 | if script.Parent.BackgroundTransparency = = 1 then |
18 | RE.OnClientEvent:Connect( function (OxGenPlrDying,OxGenRestartComplete) |
20 | changeBackgroundTransparency(OxGenPlrDying,OxGenRestartComplete) |
Your second script should be fine.
For the third script, any particular reason to disable it? How are you going to enable it after disabling it?
[EDIT 3]
The second script, I edited it a bit.
01 | local OxGenPlrDying = workspace.OxGenPlrDying |
02 | local OxGenIsOnAction = workspace.OxGenIsOnAction |
03 | local OxGenRestartComplete = workspace.OxGenRestartComplete |
04 | local RE = game:GetService( "ReplicatedStorage" ).RemoteEvent |
06 | OxGenPlrDying:GetPropertyChangedSignal( "Value" ):Connect( function () |
07 | RE:FireAllClients(OxGenPlrDying.Value,OxGenRestartComplete.Value) |
10 | OxGenRestartComplete:GetPropertyChangedSignal( "Value" ):Connect( function () |
11 | RE:FireAllClients(OxGenPlrDying.Value,OxGenRestartComplete.Value) |
16 | OxGenIsOnAction:GetPropertyChangedSignal( "Value" ):Connect( function () |
17 | RE:FireAllClients(OxGenPlrDying.Value,OxGenRestartComplete.Value) |
[EDIT 4] I edited your first script a little more. I reckon the problem should be in here since it didn't print out what's necessary.
01 | local RE = game:GetService( "ReplicatedStorage" ).RemoteEvent |
03 | RE.OnClientEvent:Connect( function (OxGenPlrDying,OxGenRestartComplete) |
05 | if OxGenPlrDying = = true then |
07 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency- 0.0001 |
08 | if OxGenRestartComplete = = true then |
09 | OxGenPlrDying.Value = false |
11 | elseif OxGenPlrDying = = false then |
12 | print ( "Player Healing" ) |
14 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency+ 0.01 |
15 | if script.Parent.BackgroundTransparency = = 0 or script.Parent.BackgroundTransparency = = 1 then break |
[EDIT 5]
I further edited your first script. Hopefully this works a bit better. Also sorry for the really late reply, was quite busy
01 | local RE = game:GetService( "ReplicatedStorage" ).RemoteEvent |
03 | RE.OnClientEvent:Connect( function (OxGenPlrDying,OxGenRestartComplete) |
05 | if OxGenPlrDying = = true then |
07 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency- 0.0001 |
08 | if OxGenRestartComplete = = true then |
09 | OxGenPlrDying.Value = false |
11 | elseif OxGenPlrDying = = false then |
12 | print ( "Player Healing" ) |
14 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency+ 0.01 |
15 | if script.Parent.BackgroundTransparency = = 0 or script.Parent.BackgroundTransparency = = 1 then break |
[EDIT 6]
Well this seems pretty challenging to me. None of the above solutions really worked... no really sure if this will now. To be honest i don't know why Player Dying and Player Healing keep printing... the only reason for that is that the BoolValue keeps alternating between false and true.
At this point, really the only way is to keep trying different methods of writing your script
add a remotefunction called "RemoteFunction" to your replicated storage and try this!
your first script (local script): warning this may cause lag but hopefully it doesn't
01 | local RE = game:GetService( "ReplicatedStorage" ).RemoteEvent |
02 | local RF = game:GetService( "ReplicatedStorage" ).RemoteFunction |
04 | RE.OnClientEvent:Connect( function (OxGenPlrDying) |
07 | if OxGenPlrDying = = true then |
09 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency- 0.0001 |
10 | if workspace.OxGenRestartComplete.Value = = true then |
14 | elseif OxGenPlrDying = = false then |
15 | print ( "Player Healing" ) |
16 | script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency+ 0.01 |
18 | if script.Parent.BackgroundTransparency = = 0 or script.Parent.BackgroundTransparency = = 1 then break |
in another new script [Script 4] a Server-Sided-Script in Server-Script-Service:::::::
1 | local RF = game:GetService( "ReplicatedStorage" ).RemoteFunction |
2 | RF.OnServerInvoke = function () |
3 | workspace.OxGenPlrDying.Value = false |
i'm actually quite confident that this will work now lol, if it still doesn't that would be quite sad xD.
i deleted the first draft because when i tried to edit it said :
"Whoa there! That's some awful long text. Please stay below 10,000 characters!
"