Hey guys, so here I am with another question.. I am currently trying to do a (Local)Script that will update the leaderstats when a Gui Textbutton is clicked.
I basically Connect my 'addPopcorn' function, but apparently I cannot pass additional parameters in the Connect? I need to tho!
local btn = game.Players.LocalPlayer.PlayerGui.popcornClick.button local leaderstats = game.Players.LocalPlayer.leaderstats function addPopcorn(amount) print(typeof(amount)) leaderstats.Popcorn.Value = leaderstats.Popcorn.Value + amount end btn.MouseButton1Click:Connect(addPopcorn(1))
Note: I know it may seem useless now, but I will edit the amount number - ignore that. Thanks.
How would I go about passing the "1"? Says it's not a function..?
Thanks in advance, and any help appreciated!
local btn = game.Players.LocalPlayer.PlayerGui.popcornClick.button local leaderstats = game.Players.LocalPlayer.leaderstats btn.MouseButton1Click:connect(function(amount) print(typeof(amount)) leaderstats.Popcorn.Value = leaderstats.Popcorn.Value + amount --side note, you can't edit leaderstat value from client if workspace.FilteringEnabled is on, you'll have to use RemoteEvents for that part. this is just a fix so you can pass arguments end)