Connect Text Label to Leaderstats
-- Get the player
local player = game.Players.LocalPlayer
-- Wait for the player's character to load
repeat wait() until player.Character
-- Access the leaderstats of the player
local leaderstats = player:WaitForChild("leaderstats")
-- Create a TextLabel
local textLabel = Instance.new("TextLabel")
textLabel.Parent = script.Parent -- Assuming this code is inside a LocalScript
-- Define the properties of the TextLabel
textLabel.Text = "Coins: " .. leaderstats.Coins.Value -- Display the value of 'Coins' in leaderstats
textLabel.Position = UDim2.new(0, 0, 0, 0) -- Set the position of the TextLabel
textLabel.Size = UDim2.new(0, 100, 0, 50) -- Set the size of the TextLabel
textLabel.Font = Enum.Font.SourceSans -- Set the font of the TextLabel
textLabel.TextSize = 20 -- Set the text size of the TextLabel
textLabel.TextColor3 = Color3.new(1, 1, 1) -- Set the text color of the TextLabel
This Lua code retrieves the player's information from the game, waits for the player's character to load, accesses the player's 'leaderstats', creates a TextLabel, and then sets the properties of the TextLabel to display the player's 'Coins' value from their leaderstats.