So I made a question earlier about this but I think I might have found an issue with it but I deleted the old form so here's a new one.
So I am trying to make an instant respawn gamepass script where if a user owns a gamepass, they will instantly respawn instead of having to wait for my 7-second death scene.
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local gamepassId = 8139794 -- My gamepass ID game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) repeat wait() until char.Humanoid char.Humanoid.Died:connect(function() if MarketplaceService:UserOwnsGamePassAsync(char.UserId, gamepassId) then plr:LoadCharacter() end end) end) end)
I do not know why it doesn't work, there is nothing in the logs from that script.
The issue with your script is you're looking up the ID from the Character, not the Player object. Since char.UserId
doesn't exist, the check always fails, and nothing happens.
Try using the following code instead:
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local gamepassId = 8139794 -- My gamepass ID game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) repeat wait() until char.Humanoid char.Humanoid.Died:connect(function() if MarketplaceService:UserOwnsGamePassAsync(plr.UserId, gamepassId) then plr:LoadCharacter() end end) end) end)
Hope I helped!