Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i add god mode with a gamepass i have a example ?

I need to add god mode but a gamepass\

**local MarketPlaceService = game:GetService("MarketPlaceService ")

local PlayerBoughtThisGamePass =  MarketPlaceService.UserOwnsGamePassAsync(Userid, GamePassiD)

if PlayerBoughtThisGamePass then

  --THE GOD MODE

end**

8 comments

0

You can set the players health to infinite like, game.Players:GetPlayerByUserId(Userid).Character.Humanoid.Health = math.huge

0

Where do i put that

0

The bit where you have --THE GOD MODE

0

Do i change anything

0

no you just put that code in there

0

Because the script is underlining user id and gamepass id and i think it wrong could this work instead? : https://scriptinghelpers.org/questions/10875/how-to-check-if-a-player-has-a-gamepass-solved

0

Well thats because id assumed youd had gamepassid and userid referenced :3

0

Then can i use the link i send and replace the print value to what you said ~

2 answers

✓ Accepted answer

This should work:

game.Players.PlayerAdded:Connect(function(plr)
	local PlayerHassPass = game:GetService("MarketPlaceService").UserOwnsGamePassAsync(plr.UserId, Gamepassidhere)
	if PlayerHasPass then
		plr.CharacterAdded:Connect(function(char)
			local hum = char:WaitForChild("Humanoid")
			hum.MaxHealth = math.huge
			hum.Health = MaxHealth
		end)
	end
end)

6 comments

0

Dont work

0

did u replace the Gamepassidhere bit

0

also replace the . before UserOwnsGamePassAsync with a :

0

I did the first one but idk about the second one?

0

NOO WORK

0

Use "hum.Health = hum.MaxHealth".

At MarketPlaceService you did .UserOwnsGamePassAsync it is :UserOwnsGamePassAsync

local MarketPlaceService = game:GetService("MarketPlaceService ")

local PlayerBoughtThisGamePass =  MarketPlaceService:UserOwnsGamePassAsync(Userid, GamePassiD)

if PlayerBoughtThisGamePass then

  --THE GOD MODE

end

This discussion is preserved as it was. New answers, comments, and votes are closed.