So, I have a RemoteEvent called AddMoney. I keep on getting this error: 10:01:43.603 - Value is not a valid member of Player. I don't know if I have something wrong with the ServerScript or the LocalScript, but I need to fix this. Any help?
ServerScript:
game.ReplicatedStorage.Events.AddMoney.OnServerEvent:Connect(function(player, cash) for _,v in pairs(game.ServerStorage.PlayerMoney:GetChildren()) do if v.Name == player.Name then v.Value = v.Value + cash.Value end end end)
LocalScript:
local events = game:GetService("ReplicatedStorage").Events local addImage = events.AddImage local addMoney = events.AddMoney local player = game.Players.LocalPlayer local gui = player.PlayerGui.ShipmentGui.ShipmentFrame local debounce = false for _,v in pairs(gui.ShipmentButtons:GetChildren()) do if (v:IsA("TextButton")) then local value = v.ItemUnlocked if (value) then v.MouseButton1Click:Connect(function() if (value.Value == true) then if (debounce == false) then debounce = true addMoney:FireServer(player, v.Money) wait(.5) gui.Visible = false wait(20) debounce = false end end end) end end end
If you're confused with the "PlayerMoney", that is just a value stored in the server so that it can't be hacked by any clients
When your firing from the client, never put your player as an argument because ROBLOX automatically does this for you.