Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

3 comments

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...

0

oh I see, I made that dumb mistake again

0

This is a common mistake for new users as well as using the default name of Value which would result as Value.Value

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.