Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

pls help me create my leaderstats?

Asked by 2 years ago
Edited 2 years ago

when i run this it adds coin and rebirgth to me in addition to my cash and energy but in my script i asked for cash and energy can you help me create my leaderstats!

my code :

function onPlayerEntered(newPlayer) wait(.5) local stats = Instance.new("IntValue") stats.Name = "leaderstats"

local score = Instance.new("IntValue")

score.Name = "Cash" -- Change "Cash" with Your Leaderstats Name
score.Value = 0

score.Parent = stats
stats.Parent = newPlayer

local score = Instance.new("IntValue")

score.Name = "Energy" -- Change "Energy" with Your Leaderstats Name
score.Value = 0

score.Parent = stats
stats.Parent = newPlayer

end

0
stats is a "Folder" not an "IntValue". radiant_Light203 1166 — 2y
0
S'il vous plaît, pouvez-vous m'écrire mon script LELINXDOR 0 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

What your problem is, is that you made stats an intvalue, not a folder and for leaderstats you would need to use a folder. Here is what you could do:

function onPlayerEntered(newPlayer) wait(.5)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"

local score = Instance.new("IntValue")

score.Name = "Cash" -- Change "Cash" with Your Leaderstats Name
score.Value = 0

score.Parent = stats
stats.Parent = newPlayer

local score = Instance.new("IntValue")

score.Name = "Energy" -- Change "Energy" with Your Leaderstats Name
score.Value = 0

score.Parent = stats
stats.Parent = newPlayer
end
Ad

Answer this question