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

I need help with my Infinite Currency Rain Script, Please?

Here are the problems that need to be fixed, that I don't know how to fix

Problem 1: The gamepass ID being mentioned in the script isn't working

And because of problem one, problem 2 and 3 happen.

Problem 2: HereComesTheMoney doesn't play

Problem 3: The message doesn't show up

I need help here ):

local id = 5131379
 
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then

game.Workspace.HereComesTheMoney.Playing = true

local message = Instance.new('Message', game.Workspace) -- Insert a new message in the Workspace.
message.Text = "Someone in the server has the Infinite Rain Gamepass, Why did he/she buy it? Anyways it'll rain Robux forever."
wait(10)
message:Destroy() -- Remove the message after 10 seconds.f

object = script.Parent 
if (object ~= nil) and (object ~= game.Workspace) then 
model = object 

backup = model:clone() -- Make the backup 
waitTime = 0.3 --Time to wait between regenerations 
wait(math.random(0, waitTime)) 
while true do 
wait(waitTime) -- Regen wait time 

model = backup:clone() 
model.Parent = game.Workspace 
model:makeJoints() 
end

2 comments

0

':connect', ':clone()', the instance 'Message', and the second argument to 'Instance.new()' are deprecated, I recommend using ':Connect', ':Clone()', a GUI object, and Parenting the created Instance separately. (respectively) (Also, you need not do a 'wait()' function followed by destroying something as the 'Debris' class has a method inbuilt situations just like this.

0

And ':makeJoints()' is deprecated. I also recommend instead using ':MakeJoints()' and indenting your code for more readability. It isn't a fix to your question, but I think keeping these in mind will help in the event those deprecated items eventually get removed.

1 answer

✓ Accepted answer

There are a couple errors in your code here.

###PlayerHasPass vs UserOwnsGamePassAsync.

ROBLOX made some changes to their gamepass servers a while back, and as such they produced a superior method. UserOwnsGamePassAsync should be used as it is the most recent and up-to-date. It is a function of MarketplaceService. Here is a demo of the code:

game.Players.PlayerAdded:Connect(function(plr)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, gamepassId) then
	print("Player owns pass!")
end)

###Messages###

A Message is deprecated and should not be used. Instead, use a TextLabel as it offers more options and isn't deprecated.

###connect###

connect is deprecated. You should be using Connect instead.

###Instance.new###

It is not recommended to use the 2nd arguement of Instance.new (deprecated & performance issues). Instead, you can set the parent by doing X.Parent = Y.

###:clone()###

:clone() is deprecated. You should be using :Clone() instead.

(EDIT REASON: didn't see :clone())

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