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

Can somebody help me fixing this problem? Attempt to connect failed: Passed value is not a function

The code:

function addcash(cash)
	game.Players.PlayerAdded:Connect(function(plr)
		plr.leaderstats.Cash += cash
	end)
end

script.Parent.ClickDetector.MouseClick:Connect(addcash(10))

Error: Attempt to connect failed: Passed value is not a function

1 answer

✓ Accepted answer

You do not need to make separate function for playeradded

can you try this?

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
      plr.leaderstats.Cash += --Put any amount of cash you want--
end)

have not tested code, tell me if there is any small error

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