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

Is it possible to make an in-game stats gui?

Is it possible to make an in-game stats gui? For example, showing how many kills you have. The KDR, and the team which is winning or losing?

3 answers

✓ Accepted answer

Sure it is.

game.Players.PlayerAdded:connect(function(Player)
	local LS = Instance.new("IntValue", Player) -- LS = leaderstats
	LS.Name = "leaderstats"
	local Kills = Instanc.e.new("IntValue", LS) -- (ClassName, Parent)
	local Kills.Name = "Kills"
	local Deaths = Instance.new("IntValue", LS)
	Deaths.Name = "Deaths"
end)

now in a ScreenGui add a script and a textlabel

local Player = game.Players.LocalPlayer
local Stats = Player.leaderstats
local Kills = Stats.Kills
local Deaths = Stats.Deaths
local KDR = ( Kills.Value / Deaths.Value )
local TL = script.Parent.TextLabel
local Team1 = game.Teams.Team1
local Team2  = game.Teams.Team2

while wait() do
	if Team1.Score > Team2.Score then
	TL.Text = "K/D: " .. tostring(KDR) .. " Winning Team:  "..Team1.Name
	elseif Team2.Score > Team1.Score then
	TL.Text = "K/D: " .. tostring(KDR) .. " Winning Team:  "..Team2.Name
	end
end

1 comment

0

1 game.Players.PlayerAdded:connect(function(Player) 2 local LS = Instance.new("IntValue", Player) -- LS = leaderstats 3 LS.Name = "leaderstats" 4 local Kills = Instanc.e.new("IntValue", LS) -- (ClassName, Parent) 5 local Kills.Name = "Kills" 6 local Deaths = Instance.new("IntValue", LS) 7 Deaths.Name = "Deaths" 8 end) Where do i put this? in a script in workspace? Thank you

Yes, it is possible to do. You would have to save their stats somehow and just display it in GUI form.

2 comments

0

Do you know how to do thtt?

0

For you, no. You would have to get the weapons you have to save their stats to the player and then have datastore save them. I might do it a different way than you would, so I would say I can help if you learn slowly along the way but I cannot just tell you or you won't learn.

You could insert BoolValue to handle the Kills and Death, and get them through a LocalScript, and display them through a TextLabel. It would be moderately challenging, but not impossible.

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