Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Solved]"attempt to preform arithmetic on field 'Points'" What does this mean?

Asked by 5 years ago
Edited 5 years ago

This question has been solved by the original poster.

Hello, I made a surfacegui shop and when you buy something, it connects to a remoteEvent that gives you the tool and takes away some points, but when I buy an item, my points count doesn't lower, and I get this in my output: ServerScriptService.Shop:14: attempt to perform arithmetic on field 'Points' (a userdata value). Does anybody know what this means and how to fix this?

--- this is a script in ServerScriptService
game.Players.PlayerAdded:Connect(function(p)
game.ReplicatedStorage.remoteEvent1.OnServerEvent:Connect(function()
game.ReplicatedStorage["Item1"]:Clone().Parent = p.Backpack
p.leaderstats.Points = p.leaderstats.Points - 25
0
You are trying to do math on a instance which is not possible. You need to access the Value held. p.leaderstats.Points.Vaue = ect... User#5423 17 — 5y
0
oh I see, I made that dumb mistake again Boi52893642864912 69 — 5y
0
This is a common mistake for new users as well as using the default name of Value which would result as Value.Value User#5423 17 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Turns out I just made a dumb mistake and I forgot to put ".Value" in after "Points"

Ad

Answer this question