#Seating script is bugged!

23 messages · Page 1 of 1 (latest)

glossy sandal
#
local allseats = game.Workspace.Building1["Swan ride 2"]["All Seats"]
local seat1 = allseats.Seat1
local seat2 = allseats.Seat2
local seat3 = allseats.Seat3
local seat4 = allseats.Seat4
local seat5 = allseats.Seat5
local seat6 = allseats.Seat6
local seat7 = allseats.Seat7
local seat8 = allseats.Seat8


players.PlayerAdded:Connect(function(player)
    
    player.CharacterAdded:Connect(function(character)

        if seat1.Claimed.Value == false then
            
            character.HumanoidRootPart.CFrame = seat1.CFrame
        elseif seat2.Claimed.Value == false then
            
            character.HumanoidRootPart.CFrame = seat2.CFrame
        elseif seat3.Claimed.Value == false then

            character.HumanoidRootPart.CFrame = seat3.CFrame
        elseif seat4.Claimed.Value == false then

            character.HumanoidRootPart.CFrame = seat4.CFrame
        elseif seat5.Claimed.Value == false then

            character.HumanoidRootPart.CFrame = seat5.CFrame
        elseif seat6.Claimed.Value == false then

            character.HumanoidRootPart.CFrame = seat6.CFrame
        elseif seat7.Claimed.Value == false then

            character.HumanoidRootPart.CFrame = seat7.CFrame
        elseif seat8.Claimed.Value == false then

            character.HumanoidRootPart.CFrame = seat8.CFrame

        end
        
    end)
    
end)```
#

When players are joined.. There supposed to go to seats

#

but some reason. When I tested. I just teleported to the first seated

#

as seen in that picture

fleet lake
#

Why a lot of statements? with iteration u can get the same just with the i

#

like

local seat = allseats["Seat" .. i]
#

and doesnt have to do a lot of ifs

verbal plaza
verbal plaza
#

Just do player.Character.Humanoid:Sit(seat)

#

And instead of claimed.Value, check if the seat.Occupant == nil

glossy sandal
verbal plaza
#

Replace each if with

#

if not seat(number).Occupant then ...

fleet lake
#

no please 😭

#

just do for i

#

its the same and its like 5 lines of code

verbal plaza
fleet lake
#

well you dont need to

broken prawnBOT
#

studio** You are now Level 13! **studio

pastel spear
fleet lake
#

no compa