i cant test it myself so please help me its suppose to find out who has the highest hidden stat.Points.Value and gives that player 1 player point

local pts= workspace.points

pts.Changed:connect(function(prop)
	if pts.Value == true then
		print("works")
		local plrs={}
		local p={}
		for _,v in pairs(game.Players:GetPlayers()) do
			pcall(function() plrs[tostring(v.userId)]=v.hiddenstats.Points.Value
			table.insert(p,v.hiddenstats.Points.Value)
					print("work2")
			end)
		end
		local m=math.max(unpack(p))
		for _,v in pairs(plrs) do
			if v==m then
										print("works3")
			pcall(function() game:GetService("PointsService"):AwardPoints(tonumber(1), 1) end)
			break
			end
		end
	end
end)

4 comments

0

Why can't you just test this?

0

#diy

0

It's 'game.Workspace', not 'workspace'

0

'workspace' works just fine. One does not have to refer to 'game.Workspace'