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

how do i add 20% additional health and speed to a gamepass?

i need to add some speed and health to my gamepass and i do not know how can someone please tell me how

2 comments

0

You check if player has gamepass > you edit their humanoid whenever their character spawns.

0

i recommend not asking questions without trying to solve the question. "Questions" like this are usually considered requests and not you looking for help. So try and solve your own problem before asking

1 answer

This is a simple enough question that doesn't require much time to answer; I've never used MarketPlaceService so I make no guarantee this script will work.

Put this in a server script (a normal script) inside ServerScriptService. Replace gamePassId by your game pass' ID.

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

local gamePassId = -- gamepass id here

Players.PlayerAdded:Connect(function(player)
	local userId = player.UserId

	if MarketPlaceServic:UserOwnsGamePassAsync(userId, gamePassId) then
		player.CharacterAdded:Connect(function(character))
			local humanoid = character:WaitForChild("Humanoid")

			humanoid.WalkSpeed *= 1.2 -- 1.2 means 120% as in +20%
			humanoid.MaxHealth *= 1.2
			humanoid.Health *= 1.2
		end)
	end
end) 

UserOwnsGamePassAsync

1 comment

0

If your computer is slow and you're testing in solo mode within studio what may happen is that the script won't work. I suggest you test the game outside studio.

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