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

Reset leaderstat value AND Datastore through GUI Button?

So I want to make a textbutton that when you click it, it resets your stage, and your DataStore. How would I do this in FilteringEnabled?

This is the script I made with a REGULAR SCRIPT in a TextButton. I know regular scripts don't work in TextButtons, but I'm confused, as you can't access DataStore through LocalScripts.

local data = game:GetService("DataStoreService"):GetDataStore("Stage")

script.Parent.MouseButton1Up:connect(function(player)
	player.leaderstats.Stage.Value = 0
	local key = "user_" .. player.userId
	data:SetAsync(key, player.leaderstats.Stage.Value)
end)

Please help!

1 answer

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