Considering that, I would strongly recommend you to check the hyperlinks in my post if you want to know how RenderStepped
and other RunService
events work. They should lead you to the Roblox API Reference Manual which contains information about them (and many other things aswell).
how i could modify the code so i can get out the car
You could change the ActionText
property of the ProximityPrompt, then check if the player is still sitting to remove them from the seat? You’d need to use the PrimaryPart
’s RightVector if you want to teleport the player to the side
i can use humanoidrootpart.cframe to move but how do i make like if you arent in a seat then you press f then you enter car and when you press f again you leave the seat (do the cframe thing)
Just
local Prompt = script.Parent.ProximityPrompt
local Seat = script.Parent
Prompt.Triggered:Connect(function(Player)
local Occupant = Seat.Occupant
local Character = Player.Character
print(Player.Name)
if not Occupant then
Seat:Sit(Character.Humanoid)
else
Character.Humanoid.Sit = false
wait(0.5)
Character.HumanoidRootPart.Position = Seat.Position + Vector3.new(5, 0, 0)
end
end)
Do something like this I guess
Also for some reason the delay when changing the property’s Humanoid has a delay so I had to implement a wait
the car bugs out and flies when i do this
I also have another question, why can’t you just jump out of the seat if you want the Player’s Character to get out of the car?
Also w h a t h o w
like i just wanna the character to be on the side of the car not the top
and about the what how look at this
this happens
I-
OKAY THAT IS ACTUALLY CURSED
Ok maybe try this?
local Prompt = script.Parent.ProximityPrompt
local Seat = script.Parent
Prompt.Triggered:Connect(function(Player)
local Occupant = Seat.Occupant
local Character = Player.Character
print(Player.Name)
if not Occupant then
Seat:Sit(Character.Humanoid)
else
Character.Humanoid.Sit = false
wait(2)
Character.HumanoidRootPart.Position = -Seat.CFrame.RightVector * 5
end
end)
LOL and i will try that to see if it works
I think that the player is welded to the seat even after the player has exited?
how can i delete the seatweld???
You could try set occupant to nil?
heres the code
local proximityPrompt = script.Parent
local seat = proximityPrompt.Parent
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if seat.Occupant then
proximityPrompt.Style = Enum.ProximityPromptStyle.Custom
else
proximityPrompt.Style = Enum.ProximityPromptStyle.Default
end
end)
proximityPrompt.Triggered:Connect(function(player)
if seat.Occupant == player.Character.Humanoid then
player.Character.Humanoid.Sit = false
wait()
player.Character.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,0)
print("hes sitting lol")
elseif seat.Occupant == nil then
seat:Sit(player.Character.Humanoid)
print("YES BABY")
end
end)
Does it work or does it make the car glitch out?
sadly it makes the car glitch out as above
Add seat.Occupant = nil above player.Character.Humanoid.Sit = false.
now i cant leave the car lol aaa
Oh? Let me test this in studio a minute.
Ah instead of that you can do seat.SeatWeld:Destroy(). It made my character automatically stand up and the player could exit also automatically sets occupant to nil.