What I need is a script, that when placed inside a GUI and a player clicks on it, it resets their level.
script.Parent.MouseButton1Up:connect(function()
????.leaderstats.lvl.Value = 0
What I need is a script, that when placed inside a GUI and a player clicks on it, it resets their level.
script.Parent.MouseButton1Up:connect(function()
????.leaderstats.lvl.Value = 0
Are you trying to have it reset the lvl value on the leaderboard when a player clicks on the button? If so then you will need to add the ButtonClicked() event. If this is a localscript use
player = game.Players.LocalPlayer
as shown in line 1
player = game.Players.LocalPlayer
function onButtonClicked()
player.leaderstats.lvl.Value = 0
end
Use a Local Script and MouseButton1Click
script.Parent.MouseButton1Click:connect(function()
local plr = game.Players.LocalPlayer
if plr.leaderstats then
local stat = plr.leaderstats:GetChildren()
for i = 1, #stat do
if stat[i].ClassName == "IntValue" or "NumberValue" then --So you don't need to find names
stat[i].Value = "0" --0
elseif stat[i].ClassName == "StringValue" then
stat[i].Value = "Level 1" --Something like this
elseif stat[i].ClassName == "BoolValue" then
stat[i].Value = false
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
What is the name for lvl is actually uppercase.