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?
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)
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
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
yes its in serverscriptservice
thanks for the link but tutorials teach me nothing like school at first i learn something but few hours later i forgot so i use free models because its easy i know people say Free model has virus and backdoor script or something but free models teach me how to script a little bit teach me how to remove something and place something so dont judge me im just the guy who make game for fun
The issue is that there is no value for Wallet yet.
but in other games it work fine
if i bring the script in other game it work fine