Auto train(clicker) help to fix

local MarketPlaceService = game:GetService("MarketplaceService")
local id = 251630884

local cooldown = 3

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(player, ido, purchased)
	if purchased and id == ido then
		local strength = player:WaitForChild("Strength")
		local strengthAdd = player:WaitForChild("Multi")

		while wait(cooldown) do
			strength.Value = strength.Value + strengthAdd.Value
		end
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	local strength = player:WaitForChild("Strength")
	local strengthAdd = player:WaitForChild("Multi")

	while true do
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then
			strength.Value = strength.Value + strengthAdd.Value
		end
		wait(cooldown)
	end
end)

I made a new script and it is in the northern script and I would like to make it so that when a That after purchasing a game pass, the player starts auto-leveling when he picks up an item

I would like it to be counted from the hit from the tool and not from there, that is, the boost from the tool would be added

Guys, please help me do this, I really need it.

What issue are you experiencing rn?

local MarketPlaceService = game:GetService("MarketplaceService")
local id = 251630884

local cooldown = 3
local ToolName = 'Punch'

local function boost(strength, strengthAdd, player: Player, multipliers)
	while task.wait(cooldown) do
		local n = multipliers[1].Value
		local owns = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, 257905319)

		for i,v in multipliers do
			if i == 1 then continue end
			n *= v.Value
		end

		if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, 257904902) then
			n *= 2    
		end

		if player.Character and player.Character:FindFirstChild(ToolName) then
			strength.Value += if owns then n*2 else n
		end
	end
end

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(player, ido, purchased)
	if purchased and id == ido then
		local multipliers = {
			player.ZoneMulti.Value,
			player.Multi.Value,
			player.BestFusion.FusionMulti.Value
		}
		local strength = player:WaitForChild("Strength")
		local strengthAdd = player:WaitForChild("Multi")

		boost(strength, strengthAdd, player, multipliers)
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	local multipliers = {
		player.ZoneMulti,
		player.Multi,
		player.BestFusion.FusionMulti
	}
	local strength = player:WaitForChild("Strength")
	local strengthAdd = player:WaitForChild("Multi")

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then
		boost(strength, strengthAdd, player, multipliers)
	end
end)

16:26:34.393 ZoneMulti is not a valid member of Player “Players.Lamino961” - Server - Script:42 error help to fix

Your player doesn’t have a ZoneMulti child element when the player joins, you will have to wait until that loads, consider using WaitForChild.

Don’t want to sound rude, but you should try learning scripting before trying to make a game, you will not be able to make it far with making games, if you don’t know scripting. This is a fairly simple issue, which you should be able to solve if you have atleast beginner lua(u) knowledge.

I have already fixed it, thanks for the answer.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.