#please help

3 messages · Page 1 of 1 (latest)

remote cloud
#

can someone please help me

local car = script.Parent.Parent.Car
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LGuiRemote = ReplicatedStorage:WaitForChild("LGuiRemote")

script.Parent.Touched:Connect(function(hit)
    local character = hit.Parent
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local player = game.Players:GetPlayerFromCharacter(character)

    if humanoid and player then
        local seatsFolder = car:FindFirstChild("Seats")

        if seatsFolder and seatsFolder:IsA("Model") then
            local seats = seatsFolder:GetChildren()

            local availableSeats = {}

            for _, seat in pairs(seats) do
                if seat:IsA("Seat") and seat:FindFirstChild("Occupant") == nil then
                    table.insert(availableSeats, seat)
                end
            end

            if #availableSeats > 0 then
                local randomSeat = availableSeats[math.random(#availableSeats)]

                local originalCFrame = character:GetPrimaryPartCFrame()
                local originalParent = character.Parent

                character:SetPrimaryPartCFrame(randomSeat.CFrame * CFrame.new(0, 1, 0))
                character.Parent = randomSeat

                LGuiRemote:FireClient(player)

                wait(1)
                character:SetPrimaryPartCFrame(originalCFrame)
                character.Parent = originalParent
                
                
            else
                print("Error: No available seats in the Seats folder.")
            end
        else
            print("Error: Car does not have a Seats folder.")
        end
    end
end)

this script works, but i dont want to be able to jump out of the seat

fading echo
#
local ContextActionService = game:GetService('ContextActionService')
ContextActionService:UnbindAction("jumpAction")