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.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.