Player can't sit again after sitting for the first time?
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.
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local PlayerInCar = game:GetService( "ReplicatedStorage" ).Players:FindFirstChild(game.Players.LocalPlayer.Name).bv_InCar |
03 | local Car = game:GetService( "ReplicatedStorage" ).Players:FindFirstChild(game.Players.LocalPlayer.Name).ov_Car |
05 | local 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 |
16 | PlayerInCar.Value = false |
17 | local movevec 2 = Vector 3. new(Car.Value.Body.TeleportPart.Position.X, Car.Value.Body.TeleportPart.Position.Y, Car.Value.Body.TeleportPart.Position.Z) |
18 | print ( "BRO ITS TRUE!" ) |
19 | print ( "REMOVE FROM CAR" ) |
20 | if game.Players.LocalPlayer.PlayerGui:FindFirstChild( "A-Chassis Interface" ) then |
21 | game.Players.LocalPlayer.PlayerGui:FindFirstChild( "A-Chassis Interface" ):Destroy() |
23 | game.Players.LocalPlayer.PlayerScripts.ls_DisableJumpRaw.Disabled = true |
24 | game.Players.LocalPlayer.Character.Humanoid.Jump = true |
25 | game.Players.LocalPlayer.Character:MoveTo(movevec 2 ) |
26 | script.Parent.frm_Main.Visible = true |
34 | UIS.InputBegan:connect(onInputBegan) |
Any pointers or literally, anything, would be greatly appreciated.
If you need context code let me know as well, i'll dig er out.