Here, I'm trying to make a gui that you put the player's name in the first textbox, and put the cash in the second textbox. After that, you click a button and then you add the cash to the player's leaderstats. I'm trying to do this but this keeps showing up. Help?
Use both scripts if needed for some odd reason:
--SERVER SCRIPT--
game.Players.PlayerAdded:Connect(function(plr)
local RS = game:GetService("ReplicatedStorage")
local twigger = RS.OwnerRemotes:WaitForChild("CashFrame")
twigger.OnServerEvent:Connect(function(plr, plrname, cash)
if game.Players:FindFirstChild(plrname) then
game.Players(plrname).leaderstats.Cash.Value = game.Players(plrname).leaderstats.Cash.Value + (cash) -- The problem/error
end
end)
end)
--LOCAL SCRIPT--
local RS = game:GetService("ReplicatedStorage")
local remotea = RS.OwnerRemotes:WaitForChild("CashFrame")
script.Parent.CB.MouseButton1Click:Connect(function()
local yeet = script.Parent.userBox.Text
local yeeter = script.Parent.cashBox.Text
remotea:FireServer(yeet, yeeter)
end)

1 comment
thx :)