PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Ordered Data Store Code Sample 2

Ordered Data Store Code Sample 2

Oct 01 2018, 2:57 AM PST

local ods = game:GetService("DataStoreService"):GetOrderedDataStore("HighScore")
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = script.Parent
local canClick = true
 
function onMouseClick(Player)
	if not canClick then
		return
	end
	canClick = false
	script.Parent.Color = Color3.new(255, 0, 0)
	ods:IncrementAsync(Player.Name, 1)
	wait(1)
	script.Parent.Color = Color3.new(0, 255, 0)
	canClick = true
end
 
clickDetector.MouseClick:Connect(onMouseClick)