function RoundSystem:AssignPlayersToChairs()
local players = self:GetActivePlayers()
local availableChairs = self:GetAvailableChairs()
players = self:ShuffleArray(players)
availableChairs = self:ShuffleArray(availableChairs)
self.assignedChairs = {}
local assignmentCount = math.min(#players, #availableChairs)
for i = 1, assignmentCount do
self.assignedChairs[players[i]] = availableChairs[i]
end
return self.assignedChairs
end
function RoundSystem:TeleportPlayersToChairs()
for player, seat in pairs(self.assignedChairs) do
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
local character = player.Character
local seatCFrame = seat.CFrame
local offsetY = 2.5
local targetCFrame = seatCFrame + Vector3.new(0, offsetY, 0)
character:PivotTo(targetCFrame)
if character:FindFirstChild("Humanoid") then
character.Humanoid.Sit = true
seat:Sit(character.Humanoid)
end
end
end
end
function RoundSystem:GetAvailableChairs()
local availableChairs = {}
for i = 1, 6 do
local chair = chairs:FindFirstChild("Chair" .. i)
if chair and chair:FindFirstChild("Seat") then
table.insert(availableChairs, chair.Seat)
end
end
return availableChairs
end```
Hello, so this is my current function of the teleporting to chairs system is similar to breaking point however the teleport is inaccurate and it doesn't even seat the player it tilts and its very buggy.
#need idea/help
1 messages · Page 1 of 1 (latest)
You have something called PivotTo()
yeah what about it