The below script is intended to put players in a seat if it is not already occupied. I have boolValues inside their corresponding parts, however when I try to test this it teleports me and someone else to seat1. Please help!
script.Parent.MouseButton1Click:Connect(function()
player = game.Players.LocalPlayer
--Makes it so the player can't reset once boarded
local function noRset()
noReset = game.Workspace.NoReset:Clone()
noReset.Parent = player:WaitForChild("PlayerGui")
end
print("hi")
if game.Workspace.seat1.Occupied.Value == false then
player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(1.3, 0.5, 9.4))
noRset()
game.Workspace.seat1.Occupied.Value = true
elseif game.Workspace.seat2.Occupied.Value == false then
player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(8.4, 0.5, 9.8))
noRset()
game.Workspace.seat2.Occupied.Value = true
elseif game.Workspace.seat3.Occupied.Value == false then
player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-23, 0.5, 7.4))
noRset()
game.Workspace.seat3.Occupied.Value = true
elseif game.Workspace.seat4.Occupied.Value == false then
player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-11.1, 0.5, 8.6))
noRset()
game.Workspace.seat4.Occupied.Value = true
end
end)

1 comment
i don't understand what any of that code does