This is probably by far the hardest multi section scripts (for now) I’ve ever done and I need assistance debugging. I have tried multiple attempts (on my own) and I could just not figure out what is causing these problems.
Note: They are all server scripts.
View to see the scripts
For the first one, it’s name “DestroyScript”.
local StarterGui = game:GetService("StarterGui")
local ScreenGui = StarterGui.ScreenGui
local serverScript = ScreenGui.Frame.TextLabel.Script
local serverScript2 = ScreenGui.Frame.TextLabel.DestroyScript
task.wait(6)
print("ACTIVATING SCRIPT")
serverScript.Enabled = true
ScreenGui.Enabled = true
serverScript2.Enabled = false
The other script that is causing a problem is a workspace script.
local StarterGui = game:GetService("StarterGui")
local ScreenGui = StarterGui.ScreenGui
local serverScript = ScreenGui.Frame.TextLabel.Script
local serverScript2 = ScreenGui.Frame.TextLabel.DestroyScript
local sound = workspace["Bensley - Vex"]
local function SCRIPTACTIVATION()
if serverScript.Disabled == true and serverScript2.Disabled == false then
local plrs = game.Players:GetPlayers()
for _, plr in pairs (game.Player:GetPlayers()) do
plr.Character.Humanoid.Health = 0
end
workspace.SpawnLocation.Enabled = false
workspace.SpawnLocation2.Enabled = true
sound:Play()
else
print("NOT ACTIVE.")
task.wait(1)
end
end
while true do
task.wait(0.05)
SCRIPTACTIVATION()
end
Here’s a video demonstration of my issue as of right now.
For context, I’m trying to get the workspace script (The 2nd one) to only run when both “DestroyScript” and Script in StarterGui.ScreenGui.Frame.TextLabel
are disabled. DestroyScript works but it doesn’t enable the ScreenGui at all or even let alone the workspace script run. The workspace script runs instantly and assumes that both “serverScript” (The disabled script in StarterGui) and “serverScript2” (The first script in the view to see scripts) are both disabled instantly, causing it to run immediately, which is not what I want.
For context of what I’m trying to make, I’m trying to make 3 scripts that first, the workspace script will detect when 2 scripts are completely disabled so it can run, disable the first spawn location and enable the other one, killing the players immediately after the 2nd script (Script in StarterGui.ScreenGui.Frame.TextLabel
) is disabled as the “DestroyScript” is also disabled.
The problem is, the workspace script (the 2nd one) immediately runs upon a player joining and bugs at when the player dies (which also needs debugging at line 10) and “DestroyScript” refuses to enable ScreenGui
(Which is seen in the video I posted, when it prints SCRIPT ACTIVATED
but does not show the ScreenGui). I’d like it if anybody told me what the issue was and help me debug the scripts, as I tried to do it multiple times (around 20 times) from changing to LocalScripts to ServerScripts, which made things worse and now I would like to just stay at ServerScripts, because the Gui is global for everyone and the event of players being killed to respawn to the 2nd spawn location is intentional. Please help. Thanks!