Error:
19:21:08.240 - ServerScriptService.Shop:4: attempt to index local 'price' (a number value)
Local:
local plr = game.Players.LocalPlayer local price = script.Parent.Price script.Parent.Item.Changed:Connect(function() script.Parent.Parent.Info.Item.Text = script.Parent.Item.Value script.Parent.Parent.Info.Price.Text = "Price: "..script.Parent.Price.Value end) script.Parent.Parent.Info.TextButton.MouseButton1Click:Connect(function() if plr.leaderstats.Money.Value >= script.Parent.Price.Value then local func = game.ReplicatedStorage.BuyRequest:InvokeServer(price.Value) if func == "Bought" then script.Parent.Parent.Info.TextButton.Text = "Bought!" end else script.Parent.Parent.Info.TextButton.Text = "Lamo, Not Enough Money" end end)
Server:
game.ReplicatedStorage.BuyRequest.OnServerInvoke =function(plr, price) local money = game.Players:FindFirstChild(plr.Name).leaderstats.Money money.Value = money.Value-price.Value return "Bought" end
Im trying to send the player and a number value through a remote function.
You are sending the value stored in the price value object through the remote event (price.Value) rather than sending the value object itself. This is fine - you just have to change line 3 in your server script to:
money.Value = money.Value-price
This will fix the error you are having, but as green271 stated in the comments, you should always check on the server if the player has enough money to do what they are trying to do. You can never trust what the client is telling you, and need to verify everything on the server.