Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Player can't sit again after sitting for the first time?

Asked by 5 years ago

Basically trying to force a player to sit and exit on the push of F The player can sit perfectly fine the first time ( as well as get off ), but after getting off the first time the player can no longer get back onto the vehicleseat. simply put, why?

I havent been able to find any reasoning as to why the player is unable to sit again.

01local UIS = game:GetService("UserInputService")
02local PlayerInCar = game:GetService("ReplicatedStorage").Players:FindFirstChild(game.Players.LocalPlayer.Name).bv_InCar
03local Car = game:GetService("ReplicatedStorage").Players:FindFirstChild(game.Players.LocalPlayer.Name).ov_Car
04 
05local function onInputBegan(input, gameProcessed)
06    if input.UserInputType == Enum.UserInputType.Keyboard then
07        local key = input.KeyCode
08        if key == Enum.KeyCode.F then
09            print("PLAYER PRESSED F!")
10            if game.Players.LocalPlayer:DistanceFromCharacter(PlayerInCar.Parent.vv_Position.Value) <= 10 then
11                if PlayerInCar.Value == false then
12                    Car.Value.DriveSeat:Sit(game.Players.LocalPlayer.Character.Humanoid)
13                    print("PLayer should be seated!")
14                    PlayerInCar.Value = true
15                elseif PlayerInCar.Value == true then
View all 34 lines...

Any pointers or literally, anything, would be greatly appreciated. If you need context code let me know as well, i'll dig er out.

0
I think it was the line 21 caused the problem... Not sure. Xapelize 2658 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Literally just added 0.01 wait time inbetween making the player jump and teleporting the player. yikes

Ad

Answer this question