So I am developing a game where your size increases every minute
and I created a gamepass where if you buy it, your growth will stop. I tried using the break
statement but this does not seem to work.
Here is my code:
local mps = game:GetService("MarketplaceService")
local gamePassID = 31123235
game.Players.PlayerAdded:Connect(function(player)
local size = 1 -- This
player.CharacterAdded:Connect(function(Character)
local Humanoid = player.Character.Humanoid
Humanoid.BodyDepthScale.Value = size
Humanoid.BodyHeightScale.Value = size
Humanoid.BodyProportionScale.Value = size
Humanoid.BodyTypeScale.Value = size
Humanoid.BodyWidthScale.Value = size
Humanoid.HeadScale.Value = size
Humanoid.WalkSpeed = 16
for x = (size+1), 999, 1 do --For loop where x + 1 each time the loop runs
wait(60)
size = x
print(x) --Print in output
Humanoid.BodyDepthScale.Value = x --Changing the values to x
Humanoid.BodyHeightScale.Value = x
Humanoid.BodyProportionScale.Value = x
Humanoid.BodyTypeScale.Value = x
Humanoid.BodyWidthScale.Value = x
Humanoid.HeadScale.Value = x
Humanoid.WalkSpeed = 16 + x*2
Humanoid.JumpPower = 50 + x*2
for v=1, 3 do
if Humanoid.Health <= 0 then
return
end
wait(1)
if mps:PlayerOwnsAsset(player, gamePassID) then
break
end
end
if mps:PlayerOwnsAsset(player, gamePassID) then
break
end
end
end)
end)
This is what I’ve tried so far
if mps:PlayerOwnsAsset(player, gamePassID) then
break
end
Thank You.