This code is pretty easy, but doesn't work for some reason D:
player = script.Parent.Parent player.leaderstats.Stage.Value.Changed:connect(function() game:GetService("PointsService"):AwardPoints(player.userId, math.random(1,10)) end) --[[OUTPUT: attempt to index field 'Value' (a number value) ]]
Also, this code won't even make the message appear D:
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if msg == ":CheckPoints" then a = Instance.new("Message") a.Parent = player a.Text = "There are ".. game:GetService("PointsService"):GetAwardablePoints().." Player Points available" elseif msg == ":CheckMyPoints" then a = Instance.new("Message") a.Parent = player gamebalance = game:GetService("PointsService"):GetGamePointBalance(player.userId) totalpoints = game:GetService("PointsService"):GetPointBalance(player.userId) a.Text = "You Earnt "..gamebalance.." Points in this game and a total of "..totalpoints.." Player Points" end end) end)
player = script.Parent.Parent player.leaderstats.Stage.Changed:connect(function() -- .Value removed game:GetService("PointsService"):AwardPoints(player.userId, math.random(1,10)) end)
Also, when you see an eror, put the line of the error and put the whole error.
for the second script, Messages inserted in a player doesn't show, the message need to be in Workspace and every players will see it. Try using a Gui to show the message.
Also, the script needs some adjustements so it will be shorter and use local variables
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if msg == ":CheckPoints" then local a = Instance.new("Message",player) -- 2nd thing is the parent, use local for better results a.Text = "There are ".. game:GetService("PointsService"):GetAwardablePoints().." Player Points available" elseif msg == ":CheckMyPoints" then local a = Instance.new("Message",player) local gamebalance = game:GetService("PointsService"):GetGamePointBalance(player.userId) local totalpoints = game:GetService("PointsService"):GetPointBalance(player.userId) a.Text = "You Earnt "..gamebalance.." Points in this game and a total of "..totalpoints.." Player Points" end end) end)