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 3 years ago
Edited 3 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 — 3y
0
S'il vous plaît, pouvez-vous m'écrire mon script LELINXDOR 0 — 3y

1 answer

Log in to vote
0
Answered by 3 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