Shift System not working

  1. I am working on a shift board that you can host shifts on.

  2. The issue is that when I try to host a shift, the staff list does not work and it prints out “attempt to index number with ‘Name’”.

  3. 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)

Can you screenshot the SurfaceGui’s location and children and send it here?

Yes. Here you go:

Is the script you’re having issues with the Attendance script I see?

Yeh. That’s the one I am having issues with.

Oh wait, did I just fix it?

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)

Does that work? charssssssssssss

Let me check, I might need to bring another account in my game.

1 Like

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

You might not understand. Let me show you a recording.

Can you send me the line of code where it makes the start shift notification pop up?

Look at this:
robloxapp-20220228-1910178.wmv (1.7 MB)

Yes, here:

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

What is the exact line of code that makes it visible??

I used BoolValue for the Values.

		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