Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How To Make A Script That Gives Our More Leaderstats Value To A Player?

Hello! I Tried Making A Script That Gives Gives Out A Higher Value(Leaderstats) To A Player That Joins. The Power (In The Script) Mean The Power Of They Have In-Game So Like A Owner Will Get 100 And The Model Creators Gets 50 And Players Get 25. My Script Says "Power is not a valid member of Folder" So I Was Hoping People Can Give Me An Answer. Thank You!

if player.Name == "Egworld" then
	game.Players:WaitForChild("Egworld").leaderstats.Power = 75
end

if player.Name not == "Egworld" then
	game.Players.Player.leaderstats.Power = 25
end

Stats Script

local function onPlayerJoin(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
 
	local power = Instance.new("IntValue")
	power.Name = "Power"
	power.Value = 25
	power.Parent = leaderstats
end
 
game.Players.PlayerAdded:Connect(onPlayerJoin)

Hopefully You Can Find An Answer ;)

2 comments

0

can you show us the explorer in leaderstats...?

0

Is your first script in a local script or a normal script?

1 answer

if player.Name == "Egworld" then
    local leaderstats = player:WaitForChild("leaderstats")
    local power = leaderstats:WaitForChild("Power")
    if power then
	   power.Value = 75
    end
end


This discussion is preserved as it was. New answers, comments, and votes are closed.