Help with instant respawn gamepass

You should not use multiple callback events within one another. It will become tedious, I’d recommend this layout instead (A script placed in StarterCharacterScripts):

local GamepassID = 703396350

local MarketplaceService = game:GetService("MarketplaceService")
local Character = script.Parent
local Player = game:GetService("Players"):GetPlayerFromCharacter(Character)

if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID) then

	Character.Humanoid.Died:Connect(function()

		Player:LoadCharacter()

	end)
	
end
1 Like

that code doesnt work you cant use Player:LoadCharacter() on the client

1 Like

This is not the client. This a server script in StarterCharacterScripts.Give it a try.
image

yeah it works thanks ill mark you solution now

1 Like

bit when respawn, the script will check if the player own gamepass which is not reallly good for the performance

is the on i made earlier better for performance

local GamepassID = 703396350

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(Player)

	if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID) then

		Player.CharacterAdded:Connect(function(Character)
		
			Character.Humanoid.Died:connect(function()
				
				Player:LoadCharacter()
				
			end)
		
		end)

	end

end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.