Hi so I made this script local GPID = script.Parent.Configuration.Gamepass.Value
local MarketplaceService = game:GetService(“MarketplaceService”)
local ProximityPromptService = game:GetService(“ProximityPromptService”)
local gui = script.NoGamePass
script.Parent.ChildAdded:connect(function(child)
if child.Name == “SeatWeld” then
local Player = game.Players:GetPlayerFromCharacter(script.Parent.SeatWeld.Part1.Parent)
if MarketplaceService:UserOwnsGamePassAsync(Player.userId, GPID) then
end
else
ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
if prompt.Name == “EndorsedVehicleProximityPromptV1” then
player.Character.Humanoid.Health = 0
player:LoadCharacter()
local a = gui:Clone()
a.Parent = player.PlayerGui
a.Enabled = true
wait(5)
a:Destroy()
end
end)
end
end) that is supposed to kill the player if they enter the car snd they dont own the gamepass but when i purchase the gamepass in test purchase in roblox studio it doesnt work it still kills me.
type or paste code here
```local GPID = script.Parent.Configuration.Gamepass.Value
local MarketplaceService = game:GetService("MarketplaceService")
local ProximityPromptService = game:GetService("ProximityPromptService")
local gui = script.NoGamePass
script.Parent.ChildAdded:connect(function(child)
if child.Name == "SeatWeld" then
local Player = game.Players:GetPlayerFromCharacter(script.Parent.SeatWeld.Part1.Parent)
if MarketplaceService:UserOwnsGamePassAsync(Player.userId, GPID) then
end
else
ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
if prompt.Name == "EndorsedVehicleProximityPromptV1" then
player.Character.Humanoid.Health = 0
player:LoadCharacter()
local a = gui:Clone()
a.Parent = player.PlayerGui
a.Enabled = true
wait(5)
a:Destroy()
end
end)
end
end)
local GPID = script.Parent.Configuration.Gamepass.Value
local MarketplaceService = game:GetService("MarketplaceService")
local ProximityPromptService = game:GetService("ProximityPromptService")
local gui = script.NoGamePass
script.Parent.ChildAdded:Connect(function(child)
if child.Name == "SeatWeld" then
local Player = game.Players:GetPlayerFromCharacter(script.Parent.SeatWeld.Part1.Parent)
if Player then
MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GPID):andThen(function(ownsGamepass)
if not ownsGamepass then
ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
if prompt.Name == "EndorsedVehicleProximityPromptV1" then
player.Character.Humanoid.Health = 0
player:LoadCharacter()
local a = gui:Clone()
a.Parent = player.PlayerGui
a.Enabled = true
wait(5)
a:Destroy()
end
end)
end
end):catch(function(err)
warn("Error checking gamepass ownership: " .. err)
end)
end
end
end)