Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

God mode gamepass script how would i add that? [closed]

Asked by 3 years ago

This question already has an answer here:

Whats the difference between Mouse.Hit & Mouse.Target?

``Ok so first off how would i add a god mode to this script SO like you NEVER DIE :

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

local gamePassID = 9349044 --Replace this set of numbers with your gamepass id

function onPlayerSpawned(player) 

    local hasPass = false

    local success, message = pcall(function()
        hasPass = MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID)
    end)
-- The script below is for checking whether or not the player has the gamepass.
    if not success then
        warn("Error while checking if player has pass: " .. tostring(message))
        return
    end

    if hasPass == true then

--GOD MODE

--END


0
I belive the end is wrong UnrealSaltyYouTube -12 — 3y
0
possibly set the player's health to math.huge? rexhawk 222 — 3y
0
you already asked this question? iOriena3 67 — 3y

Marked as Duplicate by youtubemasterWOW, kingblaze_1000, and JesseSong

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 3 years ago

Hello there. Try using a CharacterAdded event with an if statement on if the player owns the gamepass. If they do, their MaxHealth and Health get changed to math.huge (infinite).

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

local gamePassID = 9349044 --Replace this set of numbers with your gamepass id

local function onPlayerAdded(player)
    local function onCharacterAdded(character)
        if MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID) then
            character.MaxHealth = math.huge
            character.Health = math.huge
        end
    end

    player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

Please upvote and accept this answer if it helped.

Ad