WATCH THIS IF YOU DONT UNDERSTAND WHAT IM SAYING: https://streamable.com/gwjcgm
I've made a SurfaceGui button with a RemoteEvent that should decrease the value "PrinterLimit" in game.Players.LocalPlayer, but it just does not work and gives me the error: "player argument must be a Player object" or "Argument 1 missing or nil".
Here's the script inside the button that should decrease the value.
local repStorage = game:GetService("ReplicatedStorage")
local DeletePrinter = repStorage.DeletePrinter
script.Parent.MouseButton1Click:Connect(function(Player)
DeletePrinter:FireClient(Player)
Player.PrinterLimit.Value = Player.PrinterLimit.Value - 1
end)
And the LocalScript inside StarterPlayerScripts called DecreasePrinterLimit
local repStorage = game:GetService("ReplicatedStorage")
local DeletePrinter = repStorage.DeletePrinter
DeletePrinter.OnClientEvent:Connect(function(player)
print(player.Name.."just destroyed a printer!")
end)

2 comments
Works perfectly, thank you! Sorry if this question was a little bit too basic but I'm having a major problem with Server to Client remotevents, now I understand them a bit more, thank you so much!
No problem