Remote event returning player instead of number?

I’m trying to make a shop sell system, but transfering the money to the leaderstats isn’t working.
the value “Money” isn’t actually the number but the player for some reason.

Client script:

script.Parent.InputBegan:Connect(function(obj)
	if obj.UserInputType == Enum.UserInputType.MouseButton1 then
		local target = game.Players.LocalPlayer.Inventory:FindFirstChild(script.Parent.Title.Text)
		game.ReplicatedStorage.AddMoney:FireServer(game.Players.LocalPlayer,tonumber(target))
		target:Destroy()
		script.Parent:Destroy()
	end
end)

Server script: (only important part)

game.ReplicatedStorage.AddMoney.OnServerEvent:Connect(function(plr,money)
	plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + money
	local ui = Instance.new("ScreenGui")
	ui.Parent = plr.PlayerGui
	local text = Instance.new("TextLabel")
	text.TextColor3 = Color3.fromRGB(170, 170, 170)
	text.TextScaled = true
	text.Font = Enum.Font.FredokaOne
	text.BackgroundTransparency = 1
	text.Position = UDim2.new(math.random(1,10)/10,0,1,0)
	text.Parent = ui
	text.Text = "+"..money
	text.Size = UDim2.new(0, 200,0, 50)
	local tweenp = game:GetService("TweenService"):Create(text,TweenInfo.new(2,Enum.EasingStyle.Sine),{Position = UDim2.new(text.Position.X,0,0.5,0)})
	local tweent = game:GetService("TweenService"):Create(text,TweenInfo.new(2,Enum.EasingStyle.Linear),{TextTransparency = 1})
	tweenp:Play()
	tweent:Play()
	game:GetService("Debris"):AddItem(ui,2)
end)
	game.ReplicatedStorage.AddMoney:FireServer(tonumber(target))

When a client fires the server, the server automatically receives the player as the first argument, you don’t need to pass it. Replace that line with:

game.ReplicatedStorage.AddMoney:FireServer(tonumber(target))

If i print it from the server side it returns nil for some reason now.

Did you try printing tonumber(target) on the client side first? It might not be the remote event where the problem is

Done. And they both print nil.

Oh no found the problem!:
In the LocalScript the target is set as :FindFirstChild(script.Parent.Title.**Text**)
Its supposed to be:
:FindFirstChild(script.Parent.Title).**Text**

Just realised i cant set bold in code texts.

Now it says “attempt to index nil with ‘Text’”

That’s probably because :FindFirstChild() couldn’t find what you were looking for

Nevermind. Its still wrong i’m reading the code wrong

Well we know the findfirstchild isn’t finding it now.

What are you trying to do? What are you trying to find?

A Numbervalue in a folder located inside the player object.

Its trying to get the value of that and then add that to the players balance.

Are you sure, that when the script runs, the number value will even be there?

Yes i am.
It needs to be there, im even checking in the explorer

And how is script.Parent.Title that number value?

It’s finding it perfectly its even deleting it after the click, its because of the remote event then.

Its the name of it.

charcharcha