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

How to kick player out of seats before destory?

Asked by
TechModel 118
3 years ago
Edited 3 years ago

A proximity in a vehicle and when triggered it is supposed to kick a passenger and a driver out of the seat before destroying, if not then the players get this kind of glitch where they slide. How to kick players that are sitting on this 2 occupant seats, only kicking players out of those 2 seats if occupant or empty seats in case someone jumps in the sit and it gets destoryed? Thanks

local Prox = script.Parent.VehiclePrompt
local seat = script.Parent.Parent.Parent.DriveSeat
local passenger = script.Parent.Parent.Parent.Passenger

Prox.Triggered:Connect(function(plr)

    local car = game:GetService("ServerStorage"):WaitForChild("Limbo"):Clone()
    car.Parent = plr.Backpack

    seat.Parent.Sit = false
    passenger.Parent.Sit = false

    script.Parent.Parent.Parent:Destroy()
end)

Prox.ActionText = "Store"

Prox.ObjectText = script.Parent.Parent.Parent.Name

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    local hum = seat.Occupant
    if not hum then
        Prox.Enabled = true 
    else
        Prox.Enabled = false
    end
end)

passenger:GetPropertyChangedSignal("Occupant"):Connect(function()
    local hum = passenger.Occupant
    if not hum then
        Prox.Enabled = true 
    else
        Prox.Enabled = false
    end
end)

Answer this question