Attempt to perform arithmetic (add) on Instance and number

Hi!
I have an error with my script.
The script makes it so that when the player left clicks it adds 1 to their size.
Here is the error:

Here is the script:

local frame = script.Parent


local player = game.Players.LocalPlayer



local rs = game:GetService('ReplicatedStorage')

local sizeEvent = rs:WaitForChild('SizeEvent')



local mouse = player:GetMouse()


mouse.Button1Up:Connect(function()

	sizeEvent:FireServer(sizeEvent + 1)

end)

If sizeEvent is a value you need to add sizeEvent:FireServer(sizeEvent.Value + 1) as you are trying to add 1 to the instance of the value.

sizeEvent is a RemoteEvent.
Add “.Value” didn’t work.

What are you trying to do here?!

oh, so can’t you just make it go up whenever the remote fires? show us the server side of it.

I try to add 1 to the RemoteEvent when player click

You are trying to add a number to an Instance which is Not a number.

I’m not very good at scripting, what is wrong in my script and how can I patch that ?

(PS: I’m French, so my English is bad, sorry.)

You are trying to use a remote event which is responsible for talking between scripts and adding a number to it which isn’t possible.

Ok, thank you for your message.
I change my script and it’s now working.
Thank you for your time! Have a good day and holidays!

If you’re trying to record how many clicks the player did, you just need to fire the event normally and without any arguments and in the server script you have, you just need to make a table of player: clicks containing the player object and the amount of clicks they did so that you can add a new click to the existing ones by simply PlayerClicks[Player] += 1.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.