This is my gamepass only vehicle script that kills the player and prompts purchase when the player doesn't have the gamepass. I assume the kill and prompt purchase part doesn't seem to be working. The script is inside the driver's seat of the vehicle.
id = 6528838 promptpurchase = true game.Players.RespawnTime = 0 gps = game:GetService("GamePassService") local player = game.Players.LocalPlayer script.Parent.Changed:connect(function(prop) if prop == "Occupant" and script.Parent.Occupant then if gps:UserOwnsGamePassAsync(game.Players:GetPlayerFromCharacter(script.Parent.Occupant.Parent), id) then print("User in car has gamepass.") else script.Parent.Occupant:TakeDamage(100) if promptpurchase == true then game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id) end end end end
Please help if you can, it's annoying that this doesn't seem to work.
local seat = script.Parent -- Put inside your seat local assetid = 190700972 -- the gamepass's id. seat.Changed:connect(function() if seat.Occupant and not game:GetService("MarketplaceService"):PlayerOwnsAsset(game.Players:GetPlayerFromCharacter(seat.Occupant.Parent),assetid) then local player = game.Players:GetPlayerFromCharacter(seat.Occupant.Parent) seat.Occupant.Jump = true game:GetService("MarketplaceService"):PromptPurchase(player,assetid,false,Enum.CurrencyType.Robux) end end)
Try this, might not work. May have some errors. Old script I used.
For starters, use :BreakJoints(), it is easier and quicker than :TakeDamage. 2. It should be PlayerHasPass or PlayerOwnsAsset, not UserOwnsGamePassAsync... 3. Haven´t coded for a while, but I´m pretty sure you need to specify ¨Occupant¨ as a variable.