Anyway I can stop repeating all this script, Do you know how to shorten this script?
local ClickForRoomOne = workspace.RoomsToJoin.RoomOne.RoomOneClick
-- ROOM ONE
--DEFINE THE TABLE
local playersInRoomOne = {}
ClickForRoomOne.MouseClick:Connect(function(click)
if #playersInRoomOne <= 2 then
-- PLAYER JOINS ROOMS
--IF PLAYER IS ALREADY ON THE TABLE
if table.find(playersInRoomOne, click) then
print("You are already in the table!")
else -- IF PLAYER IS NOT ON TABLE ALREADY
table.insert(playersInRoomOne, click)
local RoomOnePlayerOnePoints = 0
local RoomOnePlayerTwoPoints = 0
-- IF THERE IS PLAYER ONE THEN
if playersInRoomOne[1] then
playersInRoomOne[1].Character:SetPrimaryPartCFrame(CFrame.new(124.83, -402.18, -174.04)) -- TELEPORT PLAYER
playersInRoomOne[1].Character.HumanoidRootPart.Anchored = true -- DISABLE PLAYER TO MOVE
playersInRoomOne[1].PlayerGui.RoomsGui.RoomOne.TeamBlue.TeamBlueFrame.Visible = 0
playersInRoomOne[1].PlayerGui.RoomsGui.RoomOne.TeamBlue.TeamBlueFrame.NameAndPoints.Text = playersInRoomOne[1].Name.."'s Points:"
playersInRoomOne[1].PlayerGui.RoomsGui.RoomOne.TeamBlue.TeamBlueFrame.Value.Text = RoomOnePlayerOnePoints
playersInRoomOne[1].PlayerGui.RoomsGui.RoomOne.mainText.TextLabel.TextTransparency = 0
if playersInRoomOne[2] then
playersInRoomOne[1].PlayerGui.RoomsGui.RoomOne.TeamRed.TeamRedFrame.Visible = 0
playersInRoomOne[1].PlayerGui.RoomsGui.RoomOne.TeamRed.TeamRedFrame.NameAndPoints.Text = playersInRoomOne[2].Name.."'s Points:" -- TEXT
playersInRoomOne[1].PlayerGui.RoomsGui.RoomOne.TeamRed.TeamRedFrame.Value.Text = RoomOnePlayerOnePoints -- TEXT
end
end
if playersInRoomOne[2] then
playersInRoomOne[2].Character:SetPrimaryPartCFrame(CFrame.new(88.42, -402.18, -174.04))
playersInRoomOne[2].Character.HumanoidRootPart.Anchored = true -- DISABLE PLAYER TO MOVE
playersInRoomOne[2].PlayerGui.RoomsGui.RoomOne.TeamRed.TeamRedFrame.Visible = 0
playersInRoomOne[2].PlayerGui.RoomsGui.RoomOne.TeamRed.TeamRedFrame.NameAndPoints.Text = playersInRoomOne[2].Name.."'s Points:" -- TEXT
playersInRoomOne[2].PlayerGui.RoomsGui.RoomOne.TeamRed.TeamRedFrame.Value.Text = RoomOnePlayerOnePoints -- TEXT
playersInRoomOne[2].PlayerGui.RoomsGui.RoomOne.mainText.TextLabel.TextTransparency = 0
playersInRoomOne[2].PlayerGui.RoomsGui.RoomOne.TeamBlue.TeamBlueFrame.Visible = 0
playersInRoomOne[2].PlayerGui.RoomsGui.RoomOne.TeamBlue.TeamBlueFrame.NameAndPoints.Text = playersInRoomOne[1].Name.."'s Points:"
playersInRoomOne[2].PlayerGui.RoomsGui.RoomOne.TeamBlue.TeamBlueFrame.Value.Text = RoomOnePlayerOnePoints
end
end -- ENDS IF PLAYER IS ALREADY ON TABLE
else --
-- PLAYER CANT JOIN ROOM
print("Room One Is Full")
end
local RoomOneText = game.ServerStorage.RoomServer.RoomOne.Value
-- GAME STARTS -------------------------------
if #playersInRoomOne == 2 then
RoomOneText.Value = "Game is startingggggggggg"
end
end)

4 comments
Functions and variables
How would I write it on the function, only the players in the table, eg. See a GUI Frame
I thought i explained this already
Try using a for loop