Im my game, there are cars you can drive. There are some that you need to buy in order to drive them. If you try to sit in a car you dont own, youll be ejected and a prompt will appear to buy it. Im having a problem when the player is ejected because it gets stuck in the car. I want to make the player get ejected from the car and get put next to it.
here is the script:
local seat = script.Parent--The location of the seat, if you put this script inside the seat, you will not need to change it. local CarName = "Beige Dune Buggy"--Change to Car name --Do Not Edit Past This seat.ChildAdded:connect(function(Child) if Child.Name == "SeatWeld" then local player = game.Players:GetPlayerFromCharacter(Child.Part1.Parent)--Finds the player if (player) then if player [CarName][CarName].Value == 2 then--Checks if player owns vehicle else --If they do not own it --Child:Destroy() player.Character.Humanoid:MoveTo(seat.Position+Vector3.new(0,8,0)) --player.Character.Humanoid.Jump = true --Child.Part1.Parent.Humanoid.Jump = true player.PlayerGui[CarName].Enabled = false --Shows them the purchase Gui! wait() --player.Character.Humanoid.Jump = true end end end end)