Need help with a Chamber Handout system

Hi, I am working on a Chamber handout system for my game Its a weapons testing game where the user will be able to create their own weapons and test them out on NPCs as I am working on the testing chamber for each user Only 1 chamber can be handed out and no more. Please help!

I’m getting no errors in the output area so I cant debug it either.

My code:

local Chamber1 = workspace.Chamber1.Door.MainScript.ChamberOwner
local Chamber2 = workspace.Chamber2.Door.MainScript.ChamberOwner
local Chamber3 = workspace.Chamber3.Door.MainScript.ChamberOwner
local Chamber4 = workspace.Chamber4.Door.MainScript.ChamberOwner
local Chamber5 = workspace.Chamber5.Door.MainScript.ChamberOwner
local Chamber6 = workspace.Chamber6.Door.MainScript.ChamberOwner

local CurrentPlayerCount = script.CurrentPlayerCount


local function onPlayerAdded(player)
	CurrentPlayerCount.Value = CurrentPlayerCount.Value + 1
	
	if Chamber1.Value ~= nil then
		Chamber1.Value = player.Name
	elseif Chamber2.Value ~= nil then
		Chamber2.Value = player.Name
	elseif Chamber3.Value ~= nil then
		Chamber3.Value = player.Name
	elseif Chamber4.Value ~= nil then
		Chamber4.Value = player.Name
	elseif Chamber5.Value ~= nil then
		Chamber5.Value = player.Name
	elseif Chamber6.Value ~= nil then
		Chamber6.Value = player.Name
	end
end

game.Players.PlayerAdded:Connect(onPlayerAdded)

Thanks!

1 Like