So I am making a Roblox game and everything went well, i fixed all the issues except this one, I can’t figure out why it doesn’t work and still says "attempt to compare number < Instance" because I need a remote event from the client’s side to fix the capacity of the backpack (I need to put the default value at 10 but it is 0 because it is just for rising events and being sure that it doesn’t cause more code in the same script and be lost).
I checked the client’s side if I used a number value or just number: only 10 – I checked the parameters of the remote event on the server’s side script: number – I checked if I used a variable at the beginning of the script, I changed the parameter’s name: still error… I checked Roblox’s devforum, nothing (don’t ask me why I don’t use devforum)
Server sided script
remoteEvents:FindFirstChild("FixBackpackCapacity").OnServerEvent:Connect(function(player, maxCapacityFC : number) if maxCapacityFC ~= nil and maxCapacityFC > 0 then player:FindFirstChild(player.EquippedBackpack.Value):FindFirstChild("MaxCapacity").Value = maxCapacityFC end end)
Client sided script
- I tried to remove
maxCapacityFC ~= nil, it is still triggering the same error
- It is at the right place, the condition is the problem
When you fire a RemoteEvent from the client, the
player object is supplied by the engine to the server. For example, if the client passes
a, b, c, the server will receive
player, a, b, c.
In your case, the client is providing
player, 10, so the server is receiving
player, player, 10. That is why
maxCapacityFC is acting like an Instance, because it has been assigned as an Instance of a Player.
To fix your issue, simply remove the
player variable from the
local ReplicatedStorage = game:GetService("ReplicatedStorage") local FixBackpackCapacity = ReplicatedStorage.RemoteEvents.FixBackpackCapacity FixBackpackCapacity:FireServer(10)