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

[UNANSWERED]Doesnt give cash on ppurchase?

It doesnt give the 20k on purchase.

game.Players.PlayerAdded:connect(function(player)
		if game.GamePassService:PlayerHasPass(player,405307406) then
			local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
			cashmoney.Value = cashmoney.Value + 20000
		end
end

2 answers

What you are using in your script is called an anonymous function.

When you create an anonymous function, you are actually placing everything in your code as a parameter of the "connect" method. You need to make sure that your opened parentheses are closed with a close parentheses at some point. In an anonymous function, this is typically done at the "end" that corresponds to the "connect" method.

Check this fixed script out:

game.Players.PlayerAdded:connect(function(player) -- The "connect" method has an open parentheses, but it doesn't have a closing parentheses to close it at any point in your script.
        if game.GamePassService:PlayerHasPass(player,405307406) then
            local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
            cashmoney.Value = cashmoney.Value + 20000
        end
end) --Having a closed parentheses here closes the entire "connect" method stated earlier.

So in short, you just needed to have a closing parentheses after the last "and".

Comment if you have any questions!

local code1 = "Code you want (Case Senstive)" local p = script.Parent.Parent.Parent.Parent.Parent script.Parent.Parent.GO.MouseButton1Click:connect(function() if script.Parent.Text:lower() == code1:lower() then if p:FindFirstChild('Code'..code1) then script.Parent.Text = "Already Used!" else Instance.new('Model', p).Name = ("Code"..code1) script.Parent.Text = "Redeemed!" local money = game.ServerStorage:FindFirstChild("MoneyStorage"):FindFirstChild(p.Name) money.Value = money.Value + 3500 end end end)

2 comments

1

What is this? lol

0

What...

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