I have tried changing scripts to view if there was an error on my main script and the part that failed is the part below:
local ShiftBoard = game.Workspace.ShiftBoard
local GroupID = ShiftBoard.Configuration.GroupID
local MinRank = ShiftBoard.Configuration.MinRank
game.Players.PlayerAdded:Connect(function(player)
local PlayerName = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff:FindFirstChild(player.Name)
if not PlayerName then
if player:GetRankInGroup(GroupID.Value) >= MinRank.Value then
local PlayerClone = ShiftBoard.Main.Screen.Player:Clone()
PlayerClone.Name = player.Name
PlayerClone.Text = player.Name
PlayerClone.Parent = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff
end
end
end)
function Check(player)
while wait(1) do
for i, v in pairs(game.Players:GetChildren()) do
local PlayerName = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff:FindFirstChild(player.Name)
if not PlayerName then
if player:GetRankInGroup(GroupID.Value) >= MinRank.Value then
local PlayerClone = ShiftBoard.Main.Screen.Player:Clone()
PlayerClone.Name = player.Name
PlayerClone.Text = player.Name
PlayerClone.Parent = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff
end
end
end
end
end
spawn(Check)
local ShiftBoard = game.Workspace.ShiftBoard
local GroupID = ShiftBoard.Configuration.GroupID
local MinRank = ShiftBoard.Configuration.MinRank
game.Players.PlayerAdded:Connect(function(player)
while wait(1) do
for i, v in pairs(game.Players:GetChildren()) do
local PlayerName = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff:FindFirstChild(player.Name)
if not PlayerName then
if player:GetRankInGroup(GroupID.Value) >= MinRank.Value then
local PlayerClone = ShiftBoard.Main.Screen.Player:Clone()
PlayerClone.Name = player.Name
PlayerClone.Text = player.Name
PlayerClone.Parent = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff
end
end
end
end
end)
YES! IT WORKS! Also why is this running another time when I end the shift, so let me explain when I start a shift it gives me the warning if I want to start a shift and then when I end the shift it also give me the warning if I want to start a shift. Why does it do that?
if script.End.Value == true then
EndShift.Visible = false
StartShift.Visible = true
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Visible = false
ShiftBoard.Main.Screen.SurfaceGui.Home.Visible = true
script.End.Value = false
script.Start.Value = true
end
if script.Warn.Value == true then
WarningShift.Visible = false
EndShift.Visible = true
ShiftBoard.Main.Screen.SurfaceGui.Home.Visible = false
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Visible = true
script.Warn.Value = false
script.End.Value = true
for i,v in pairs(ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff:GetChildren()) do
v:Destroy()
end
local ONG = ShiftBoard.Main.Screen.UIListLayout:Clone()
ONG.Parent = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Info.Host.Text = "Shift Host: " .. player.Name
end
if script.Start.Value == true then
StartShift.Visible = false
WarningShift.Visible = true
script.Warn.Value = true
script.Start.Value = false
end
local WarningShift = ShiftBoard.Main.EventDetector.SurfaceGui.Frame.WarningShift
local StartShift = ShiftBoard.Main.EventDetector.SurfaceGui.Frame.StartShift
local EndShift = ShiftBoard.Main.EventDetector.SurfaceGui.Frame.EndShift
local Debounce = false
ShiftBoard.Main.EventDetector.ClickDetector.MouseClick:Connect(function(player)
if player:GetRankInGroup(GroupID.Value) >= MinRank.Value then
if not Debounce then
Debounce = true
ShiftBoard.Main.EventDetector.Granted:Play()
if script.End.Value == true then
EndShift.Visible = false
StartShift.Visible = true
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Visible = false
ShiftBoard.Main.Screen.SurfaceGui.Home.Visible = true
script.End.Value = false
script.Start.Value = true
end
if script.Warn.Value == true then
WarningShift.Visible = false
EndShift.Visible = true
ShiftBoard.Main.Screen.SurfaceGui.Home.Visible = false
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Visible = true
script.Warn.Value = false
script.End.Value = true
for i,v in pairs(ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff:GetChildren()) do
v:Destroy()
end
local ONG = ShiftBoard.Main.Screen.UIListLayout:Clone()
ONG.Parent = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Info.Host.Text = "Shift Host: " .. player.Name
end
if script.Start.Value == true then
StartShift.Visible = false
WarningShift.Visible = true
script.Warn.Value = true
script.Start.Value = false
end
wait(2)
Debounce = false
end
end
end)
while wait(1) do
if script.Warn.Value == true then
wait(5)
WarningShift.Visible = false
StartShift.Visible = true
script.Warn.Value = false
script.Start.Value = true
end
end
if script.Warn.Value == true then
WarningShift.Visible = false
EndShift.Visible = true
ShiftBoard.Main.Screen.SurfaceGui.Home.Visible = false
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Visible = true
script.Warn.Value = false
script.End.Value = true
for i,v in pairs(ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff:GetChildren()) do
v:Destroy()
end
local ONG = ShiftBoard.Main.Screen.UIListLayout:Clone()
ONG.Parent = ShiftBoard.Main.Screen.SurfaceGui.Hosting.Staff
ShiftBoard.Main.Screen.SurfaceGui.Hosting.Info.Host.Text = "Shift Host: " .. player.Name
end