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

How do you make a team leader stats gui?

I'm making a coop game and want to show the amount of cash the team has as a GUI or just how to get the team's leader stats for other purposes

2 answers

Create a ScreenGui inside PlayerGui . Create a TextLabel and parent it to the ScreenGui you made. Then just wait for the leaderstat value to change and update the TextLabel text

--- Inside a server script placed anywhere
game.Players.PlayerAdded:Connect(function(player)
    local Stats= Instance.new("Folder")
    Stats.Name = "leaderstats"
    Stats.Parent = player

    local Cash = Instance.new("NumberValue")
    Cash .Name = "Cash"
    Cash .Value = 0
    Cash .Parent = leaderstats
end
-- Inside a local script placed inside the TextLabel you made
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
local cash = stats:WaitForChild("Cash")
cash:GetPropertyChangedSignal("Value"):Connect(function()
	script.Parent.Text = cash.Value
end

2 comments

0

This is correct but this will only show the cash value once the value has changed.

0

I mean all you have to do is run script.Parent.Text = cash.Value again outside of the function so it updates to what it currently is. You shouldnt have to run the code any other time than when the value is updated

In a server script:

game.Players.PlayerAdded:Connect(function(player)
	-- Make the leaderstats folder. Any values created in here will be displayed like the leaderboards in other games.
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	-- Create the values. You can name them whatever you want.
	local cash = Instance.new("NumberValue")
	cash.Name = "Cash"
	cash.Value = 0
	cash.Parent = leaderstats
end

3 comments

0

this isn't the script i'm looking for this is just a leaderstats script

0

NumberValue? Isn't it IntValue?

0

I think a numbervalue and intvalue are the same thing, but as for the teams, gyou need to insert a teams folder into the game. Go to the model tab, and in the advanced section, click on service and add teams. In the teams folder, right click it and add as many teams objects as you want to them.

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