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

How Would I go About an Auto Collect Gamepass for Tycoon?

I need to do this project for a friend, but I'm not entirely sure on how I should go about it. There is a script that gives the player the cash once they step on the brick, but I want it to instead give the player directly to the player once the part hits the conveyor collector.

Here is my script so far for once you buy it!

local marketPlace = game:GetService("MarketplaceService")
local passId = 0000 -- Pass Id not available yet

function isAuthenticated(player)
	return marketPlace:PlayerOwnsAsset(assetId, player)
end

game.Players.PlayerAdded:connect(function(plr)
	if isAuthenticated(plr) then
		-- Not sure how to make it
	end
end)

script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		marketPlace.PromptPurchaseFinished:connect(function(player, assetid, isPurchased)
			if isPurchased then
				if assetId == passId then
					-- Not sure what to do exactly
				end
			end
		end)
end)

Thanks for any and ALL help I get!

2 comments

0

You could modify the conveyor collector to check if the player has the gamepass, if it does, transfer money directly to the player. If not, transfer money to the money giving brick.

0

Nice idea, thanks!

1 answer

I mean, you could make a diffrent version of the script that calculates and distrubutes the money and have that directly give the money to the player (put it in replicated storage) . Then what you could do is that you destroy the orginal sript and take the new script and put it in its place.

local Newscript = Put.The.Directory.To.It:Clone()
local Originalscript = game.RelpicatedStorage.Heythescript
-- These are obviously jokes, replace the stuff after the equal sign
Originalscript:Destroy()
Newscript.Parent= Link.The.Parent.To.Where.This.Goes
--Again, jokes. Replace the stuff after equalsign

3 comments

0

I hope this helps, that was me just blabbering.

0

Also, this is me being crazy, but mabye this might work depending how that chash giving script works. You could have and invisible humanoid stand on the cash giving button.

0

I'm not sure about this code.

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