game:GetService("Players").PlayerAdded:Connect(function(p) -------------------< folder >------------------ local leaderstats = Instance.new("Folder") leaderstats.Parent = p leaderstats.Name = "leaderstats" -------------------< strenght >----------------------- local str = Instance.new("IntValue") str.Parent = leaderstats str.Name = "Strenght" str.Value = 0 ---------< strenght tied to the text label >--------- local textLabel = game.StarterGui.Strenght.TextLabel textLabel.Text = "Strenght:"..str.Value end)
i am trying to connect the int value that stores the strenght to a text label the int value works and adds 5 to its value every time i click any help?
Firstly, it'd work if you did it this way
game:GetService("Players").PlayerAdded:Connect(function(p) -------------------< folder >------------------ local leaderstats = Instance.new("Folder") leaderstats.Parent = p leaderstats.Name = "leaderstats" -------------------< strenght >----------------------- local str = Instance.new("IntValue") str.Parent = leaderstats str.Name = "Strenght" str.Value = 0 ---------< strenght tied to the text label >--------- local textLabel = p.PlayerGuiGui.Strenght.TextLabel textLabel.Text = "Strenght:"..str.Value end)
As a BETTER alternative is doing it this way.. GUI > Local Script
local stats = game.Players.LocalPlayer:WaitForChild("leaderstats") local Strenght = stats.Strenght Strenght.Changed:Connect(function() script.Parent.Strenght.TextLabel.Text = "Strenght: "..stats.Value end)