Hey, I’m trying to make a intvalue in the player instance and it’s not being created, any idea why?
local playfol = Players:FindFirstChild(Player)
local leaderstats = Instance.new("IntValue", playfol)
leaderstats.Name = "KillCount"```
Hey, I’m trying to make a intvalue in the player instance and it’s not being created, any idea why?
local playfol = Players:FindFirstChild(Player)
local leaderstats = Instance.new("IntValue", playfol)
leaderstats.Name = "KillCount"```
You don’t need “playfol” just make the parent “Player” (Assuming that “Player” is the parameter of a playeradded event).
Also, don’t use the parent argument in instance.new.
local leaderstats = Instance.new("IntValue")
leaderstats.Name = "KillCount"
leaderstats.Parent = Player
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”,player)
leaderstats.Name = “leaderstats”local KillCount = Instance.new(“IntValue”,leaderstats)
KillCount.Name = “KillCount”
KillCount.Value = 0 – this value increases whenever player kills a human player
This Should Work.
don’t use the second argument of instance.new please.
This should work.
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder")
Leaderstats.Name = "leaderstats"
Leaderstats.Parent = Player
local KillCount = Instance.new("IntValue")
KillCount.Name = "KillCount"
KillCount.Parent = Leaderstats
end)
why we shouldn’t use that is there something wrong with it?
It is one of the worst ways of creating an object via a script. You are getting the parent first.