so i have a problem where my leaderstats only say minus or - weird thing its my other leaderstats work but other only say minus or - but sometimes the leaderstats not showing up
What do you mean by this? Do the values have a “-” in them?
my leaderboard saying like this
but the weird thing its if i place my leaderstats on another game it works
Can you show the script for us to check it?
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local Wallet = Instance.new("IntValue")
Wallet.Name = "Wallet"
Wallet.Value = 250
Wallet.Parent = stats
stats.Parent = newPlayer
while wait(60) do
Wallet.Value = Wallet.Value + 52
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
still not work it still says -
i try deleting other script and the number show so im gonna investigate the script
Your leaderstats are an IntValue. You need the instance to be a folder.
This is how it should be:
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = newPlayer
local Wallet = Instance.new("IntValue")
Wallet.Name = "Wallet"
Wallet.Value = 250
Wallet.Parent = stats
but the leaderstats dosent show up
Try this
also make sure the script is inside ServerScriptService
function onPlayerEntered(newPlayer)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
local Wallet = Instance.new("IntValue")
Wallet.Name = "Wallet"
Wallet.Value = 250
Wallet.Parent = stats
stats.Parent = newPlayer
while wait(65) do
Wallet.Value += 52
end
end
game.Players.PlayerAdded:Connect(onPlayerEntered)
Try using this, the name of the function and some of the variables is changed, you could change them back if you want.
local function playerAdded(player)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = player
local Wallet = Instance.new("IntValue")
Wallet.Name = "Wallet"
Wallet.Value = 250
Wallet.Parent = stats
while wait(65) do
Wallet.Value = Wallet.Value + 52
end
end
game:GetService("Players").PlayerAdded:Connect(playerAdded)
(btw you should probably use PlayerAdded
instead of ChildAdded
because it’s meant for doing stuff like this)
yeah it work but the capture leaderstats dosent work it only say -
local TeamService = game:GetService("Teams")
local RedTeam = TeamService:WaitForChild("Red")
local BlueTeam = TeamService:WaitForChild("Blue")
game.Players.PlayerAdded:Connect(function(Player)
local LeaderBoard = Instance.new("Folder", Player)
LeaderBoard.Name = "leaderstats"
local Captures = Instance.new("IntValue", LeaderBoard)
Captures.Value = 0
local Wallet = Instance.new("IntValue", LeaderBoard)
Wallet.Value = 0
-- Code here where team should the player is
-- Example random team:
local Teams = {RedTeam, BlueTeam}
local Randomizer = math.random(1, #Teams)
Player.Team = Teams[Randomizer]
end)
Can you show us the script that creates the “Captures” instance?
Can you show us your Captures
script?
Try to use the point scoring tutorial as a refrence. It has all the basics for what you want to do.
https://developer.roblox.com/en-us/onboarding?category=basic-coding
Do you have any errors in the output when you play the game
Is that script inside ServerScriptService?
no there no errors its kinda weird theres no error