I was wondering how I could add a certain value to a local players leader stat. I have tried something here but it doesn’t seem to be working -
local guipart = game.Workspace.guipart
local Players = game:GetService("Players")
local function End(clonedgui)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local minutes = 0
local seconds = 15
repeat
if seconds <= 0 then
minutes = minutes - 1
seconds = 59
else
seconds = seconds - 1
end
if seconds < 10 then
clonedgui.TextLabel.Text = tostring(minutes)..":0"..tostring(seconds)
else
clonedgui.TextLabel.Text = tostring(minutes)..":"..tostring(seconds)
end
wait(1)
until minutes <= 0 and seconds <= 0
if minutes <=0 and seconds <=0 then
clonedgui:Destroy()
Players.LocalPlayer.leaderstats.Stage.Value = Players.LocalPlayer.leaderstats.Stage.Value + 1
end
end
At the end of the script the local player is supposed to gain a value of one but studio just gives me the error “ServerScriptService.Main:25: attempt to index nil with ‘leaderstats’”. How would I fix this?