I have a normal seat, if the player owns a gamepass they will stay seated. If they don’t own the gamepass they will be “kicked” from the seat.
What is the problem
I use Humanoid.Jump = true for this. It works the first time but the second it only prompts and does not kick the player out of the seat.
The script
local gamepassid = 4129623
script.Parent.Changed:Connect(function()
if script.Parent.Occupant then
local occupant = script.Parent.Occupant
if game.Players:GetPlayerFromCharacter(occupant.Parent) then
local player = game.Players:GetPlayerFromCharacter(occupant.Parent)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,gamepassid) then
-- do nothing
else
occupant.Jump = true
game:GetService("MarketplaceService"):PromptGamePassPurchase(player,gamepassid)
end
end
end
end)
What I need help with
I need help to figure out what I have done wrong and how to fix the problem
if script.Parent:FindFirstChild("SeatWeld") then
script.Parent.SeatWeld:Destroy()
end
I’m not sure if this is an issue, but I’ve seen other people run into the same issue, I’m pretty sure making the character jump should dismount the character.
Edit:
Another way is to set the Humanoid.Sit to false
Thanks for your input! I tried the piece of code you sent. I still got the same problem, works the first time but not the second. The second time it said the following: Something unexpectedly tried to set the parent of SeatWeld to NULL while trying to set the parent of SeatWeld. Current parent is Seat.