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

Adding a x2 Strength Gamepass?

This is the First Simulator that I have ever made and I am confused on how to add a 2x Strength script and where to put it? Do I just make a separate script for a regular script or local script and it goes into server script service?

local MarketpalceService = game:GetService("MarketplaceService")
 local Players = game:GetService("Players") 
if MarketpalceService:UserOwnsGamePassAsync(Players:GetUserIdFromNameAsync(object.Parent.Name), 7142533) then
	print("User owns the 2X Gamepass.") print("Strength: "..Strength * 2) 
else 
	print("User does not own the 2X Gamepass.")
	print("Strength: " ..Strength)
end

1 comment

0

We'll looking at how we don't know where the value is located and we need more information so can't help you there bud.

1 answer

✓ Accepted answer

You can put it wherever you want, but to avoid hackers, make the check for the gamepass on the server: Check if the player owns the gamepass at the beginning of the game and make/update a variable in game called hasDoubleStatsPass which the game can check if the player has when they do something in game to get stats.

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

playerId= Players:GetUserIdFromNameAsync(object.Parent.Name)

if(MarketplaceService:UserOwnsGamePassAsync(playerId,7142533))then
	print("User owns the 2X Gamepass.") 
	print("Strength: "..Strength * 2) 
else 
    print("User does not own the 2X Gamepass.")
    print("Strength: " ..Strength)
end

2 comments

0

It doesn't work lucyy! :(

0

any errors?

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