#i need help this doesnt work its suppossed to teleport users into the seats force them to exit

39 messages · Page 1 of 1 (latest)

merry swallow
#

IK IS CHATGPT XD

#

😭

jagged olive
#

Wait can you describe what you're trying to do again with the code?

#

Because it seems like you're describing like a player teleport in a single game

#

because most of the code doesn't match what I think you're trying to say in the description

#

Ngl this post kinda relieves me because it shows I won't get replaced just yet by AI unless the text input was kinda messy

#

heheh

thorn osprey
#

bro

#

poorly made code

#

IT LITERALLY TELEPORTS TO ANOTHER GAME

#

INSTEAD OF TELEPORTING TO THE SEAT

jagged olive
#

So technically

#

it ain't his fault

thorn osprey
#

bro

#

wtf is this A.I bro

jagged olive
#

Lets just make fun of the AI

thorn osprey
#

not your fault tho bud

#

just the AI

#

anyways cya

jagged olive
#

Don't use AI for programming just yet lol

merry swallow
jagged olive
#

Sit () method has an arg for a humanoid

#

And to like prevent them from leaving

#

you can call the SetStateEnabled method of like the humanoid of the current player you trying to sit

#

and do something like thos

#

Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)

#

btw fucking hate phones rn

#

can't so that dot thing to format this and make it look nicer

pale steppe
rain bough
#

the ai just send you to the other game

#

instead of seat

jagged olive
merry swallow
#

i tried to use this script

#

-- Define the seats as variables
local seats = {
game.Workspace.S1,
game.Workspace.S2,
game.Workspace.S3,
game.Workspace.S4,
game.Workspace.S5,
game.Workspace.S6
}

-- Define a function to check if a seat is occupied
local function isSeatOccupied(seat)
for _, child in ipairs(seat:GetChildren()) do
if child:IsA("Humanoid") then
return true
end
end
return false
end

-- Define a function to put a player in a seat
local function putPlayerInSeat(player, seat)
-- Create a new humanoid for the player
local humanoid = Instance.new("Humanoid")
humanoid.Parent = player.Character
humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

-- Move the player to the seat
player.Character:SetPrimaryPartCFrame(seat.CFrame)

end

-- Define a function to force all players into seats
local function forcePlayersIntoSeats()
local players = game.Players:GetPlayers()
for i, seat in ipairs(seats) do
if i > #players then
break
end
local player = players[i]
if not isSeatOccupied(seat) then
putPlayerInSeat(player, seat)
end
end
end

-- Call the function once at the start of the game to force players into seats
forcePlayersIntoSeats()

-- Define a function to prevent players from leaving their seats
local function preventPlayersFromLeavingSeats()
for _, player in ipairs(game.Players:GetPlayers()) do
local character = player.Character
if character then
for _, seat in ipairs(seats) do
if seat:IsDescendantOf(character) and not isSeatOccupied(seat) then
putPlayerInSeat(player, seat)
end
end
end
end
end

-- Call the function repeatedly to prevent players from leaving their seats
game:GetService("RunService").Stepped:Connect(preventPlayersFromLeavingSeats)

#

the script and seats are suppossed to be in workspace

#

and it still doesnt work