#humanoid doesnt get seated

101 messages · Page 1 of 1 (latest)

vale snow
#

local prompt = game.Workspace:WaitForChild("Car"):WaitForChild("Body"):WaitForChild("prom"):WaitForChild("ProximityPrompt")
local phum = game.Players.LocalPlayer:WaitForChild("Character")
local hum = phum:WaitForChild("Humanoid")
local seat = prompt.Parent.Parent.Parent.DriveSeat

prompt.Triggered:Connect(function()
seat:Sit(hum)
end)

jolly nymph
#

hmmm

#

if this is a local script it won't have access to humanoid

#

@vale snow

#

so you will need to do this in 2 separate scripts

#

one local another server script

vale snow
#

its a normal scripot

#

oh wait no

#

sry

#

its a local

#

so what do i put in the server script

jolly nymph
#

you know how to do it?

vale snow
#

no

jolly nymph
#

im the local you do som like this

#
local plr = game.Players.LocalPlayer
local RP = game:GetService("ReplicatedStorage")
Create a remote named SeatPlayer
local SP = RP:FindFirstChild("SeatPlayer")


prompt.Triggered:Connect(function()
    SP:FireServer()
end) ```

Local script
vale snow
#

wdym rp

#

ah rp

#

now ik

jolly nymph
#

Create a remote event in rp

vale snow
#

so just the localscript in rp?

jolly nymph
#

no

vale snow
#

i creasted event

jolly nymph
#

the local put it in the promt

vale snow
#

but locals dont work in workspace

#

oki did

jolly nymph
#

inside the promt

vale snow
#

yes

#

and name theevent seatplayer?

jolly nymph
#
local spRE = rp:FindFirstChild("SeatPlayer")

spRE.OnServerEvent:Connect(function(player)
    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:WaitForChild("Humanoid")
    local seat = game.Workspace.Car.Body.prom.DriveSeat

    if seat:IsA("VehicleSeat") then
        seat:Sit(humanoid)
    else
        warn("Seat is not working")
    end
end) ```
In ServerScriptService
jolly nymph
vale snow
#

yes

#

ok

#

what now

jolly nymph
#

done

vale snow
#

doesnt work

jolly nymph
#

why

vale snow
#

it doesnt seat me

jolly nymph
#

i'm sorry

vale snow
#

ok andn now it works?

jolly nymph
#

where is the seat more exacly?

vale snow
#

i mean the path says it

jolly nymph
vale snow
#

now in the pürompt as you told me

jolly nymph
#

wait let's be where we was in the first time

#

the script was into

vale snow
#

it was in starterplayerscriopt

jolly nymph
#

yes let it in the starterplayerscript

#

ok

vale snow
#

found the error

jolly nymph
#

what is it

vale snow
#

driveseat is just in car

#

yes it works now

#

tysm

#

btw

jolly nymph
#

srry for not understanding

vale snow
#

why is this camer like this

#

camera*

jolly nymph
#

hmmm

#

some scripts can control the camera

#

but idk if this is the case

#

You could do a script for this

#

@vale snow

vale snow
#

i think ill just let it be like that

jolly nymph
#
local cam = workspace.CurrentCamera

local function updateCam()
    local char = plr.Character or plr.CharacterAdded:Wait()
    local hRP = char:WaitForChild("HumanoidRootPart")

    cam.CFrame = CFrame.new(hRP.Position) * CFrame.new(0, 5, -10) 
end

game:GetService("RunService").RenderStepped:Connect(updateCam)```
paste this in starterplayerscripts
#

as local script

#

you can adjust the offsets as you want

#

this script does the camera to fallow the player

vale snow
#

no i dont need that but how do i get the prompt to re enable when exiting the car like what checks if the player is seatd

jolly nymph
#

To re enable a promt when a plr exists a car you can use seat events to check for the player is seated or not

#

& for this you need a script in the car

vale snow
#

and what is the event called<?

jolly nymph
#

sry function

#

you say local function oocupantchanged()

#

yk what to say

#

i'll not do this script cuz it's to eazy

vale snow
#

so just a script in the car?

jolly nymph
#

yes

vale snow
#

but idk how to do it

#

like

#

the occupantchanged function what should be in it

jolly nymph
#

ok i'll just do the script cuz i need to leave

#
local seat = where is the seat
local prompt = where is the promt

local function onOccupantChanged()
    if seat.Occupant then
        prompt.Enabled = false 
    else
        prompt.Enabled = true 
    end
end

seat.OccupantChanged:Connect(onOccupantChanged) ```
vale snow
#

k ty

jolly nymph
#

My pleasure

junior spruceBOT
#

studio** You are now Level 8! **studio

jolly nymph
#

Does it work

#

@vale snow

vale snow
#

I haven’t tried bc I’ll be back in and hour

jolly nymph
#

Ok

jolly nymph
#

So?

vale snow
#

it doesnt work @jolly nymph

#

occupantchanged isnt a member

jolly nymph
#

Srry, onOccupantChanged

#

At the end

vale snow
#

i got it fixed with chatgpt

#

but still ty for your help

jolly nymph
#

My pleasure

jolly nymph
#

I didn't put onOccupantChanged

#

I was in rush