Hey There! I was wondering why my basic leader stats script isn’t working? Heres the script
local leaderstats = Instance.new("Folder")
local timeInGame = Instance.new("IntValue")
game.Players.PlayerAdded:Connect(function(player)
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
timeInGame.Name = "Minutes"
timeInGame.Parent = leaderstats
while wait(1) do
player.leaderstats.Minutes = player.leaderstats.Minutes.Value + 1
end
end)
I am very confused as to why this is not working since Minutes is clearly under the leaderstats folder in the Player
CZXPEK
(czo)
November 20, 2022, 11:15pm
#2
You need to create the leaderstats folder first
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local timeInGame = Instance.new("IntValue")
timeInGame.Name = "Minutes"
timeInGame.Parent = leaderstats
while wait(1) do
player.leaderstats.Minutes = player.leaderstats.Minutes.Value + 1
end
end)
I forgot to copy and paste it lol leaderstats is here
1 Like
SOTR654
(SOTR654)
November 20, 2022, 11:23pm
#4
Add .Value
and use the variable
game:GetService("Players").PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local timeInGame = Instance.new("IntValue")
timeInGame.Name = "Minutes"
timeInGame.Parent = leaderstats
while task.wait(1) do
timeInGame.Value += 1
end
end)
1 Like
system
(system)
Closed
December 4, 2022, 11:23pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.