Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- coroutine.wrap(function()
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "FullScreenGUI"
- screenGui.ResetOnSpawn = false
- screenGui.IgnoreGuiInset = true -- Ensures it covers the entire screen, including the top area
- -- Add to CoreGui
- screenGui.Parent = game:GetService("CoreGui")
- -- Create a Frame to hold the text
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(1, 0, 1, 0) -- Fullscreen
- frame.Position = UDim2.new(0, 0, 0, 0)
- frame.BackgroundColor3 = Color3.new(0, 0, 0) -- Black background
- frame.BorderSizePixel = 0
- frame.Parent = screenGui
- -- Create a UIListLayout for text alignment
- local layout = Instance.new("UIListLayout")
- layout.HorizontalAlignment = Enum.HorizontalAlignment.Center
- layout.VerticalAlignment = Enum.VerticalAlignment.Center
- layout.SortOrder = Enum.SortOrder.LayoutOrder
- layout.Parent = frame
- -- Create a function to add text elements
- local function createTextElement(parent, text)
- local textLabel = Instance.new("TextLabel")
- textLabel.Text = text
- textLabel.Font = Enum.Font.GothamBold
- textLabel.TextColor3 = Color3.new(1, 1, 1) -- White text
- textLabel.TextScaled = true
- textLabel.Size = UDim2.new(1, 0, 0.1, 0) -- Adjust size for each label
- textLabel.BackgroundTransparency = 1
- textLabel.Parent = parent
- return textLabel
- end
- -- Add text elements to the frame
- local playerName = game.Players.LocalPlayer.Name
- createTextElement(frame, "Username: " .. playerName) -- Display the player's username
- local coinGainLastMatchLabel = createTextElement(frame, "❄️ Coin Gain Last Match: 0") -- Initialize as 0
- local coinGainLabel = createTextElement(frame, "❄️ Coin Gain: 0") -- Initialize as 0
- local totalCoinLabel = createTextElement(frame, "❄️ Total Coin: Loading...") -- Placeholder text
- -- Path to the candyText
- local candyTextLabel = game:GetService("Players").LocalPlayer.PlayerGui.CrossPlatform.Christmas2024.Container.EventFrames.BattlePass.Info.Tokens.Container.TextLabel
- -- Store the initial CandyText value
- local initialCandyText = tonumber(candyTextLabel.Text) or 0
- local coinGainLastMatch = 0 -- Track coins collected during the last match
- -- Function to update Coin Gain and Total Coin
- local function updateCoinData()
- local currentCandyText = tonumber(candyTextLabel.Text) or 0 -- Safely convert to number
- local coinGain = currentCandyText - initialCandyText -- Calculate coins gained since script started
- coinGainLabel.Text = "❄️ Coin Gain: " .. tostring(coinGain) -- Update Coin Gain
- totalCoinLabel.Text = "❄️ Total Coin: " .. tostring(currentCandyText) -- Update Total Coin
- end
- -- Reset Coin Gain Last Match when a new match starts
- local function resetCoinGainLastMatch()
- coinGainLastMatch = 0
- coinGainLastMatchLabel.Text = "❄️ Coin Gain Last Match: " .. tostring(coinGainLastMatch)
- end
- -- Add coins to Coin Gain Last Match
- local function addCoinToLastMatch(cointype, current, max)
- if cointype == "SnowToken" then
- coinGainLastMatch = coinGainLastMatch + 1 -- Increment coin count
- coinGainLastMatchLabel.Text = "❄️ Coin Gain Last Match: " .. tostring(coinGainLastMatch)
- end
- end
- -- Connect the TextChanged event to dynamically update Coin Gain and Total Coin
- candyTextLabel:GetPropertyChangedSignal("Text"):Connect(updateCoinData)
- -- Initial update
- updateCoinData()
- -- Connect to CoinCollectedEvent to track Coin Gain Last Match
- local CoinCollectedEvent = game.ReplicatedStorage.Remotes.Gameplay.CoinCollected
- CoinCollectedEvent.OnClientEvent:Connect(addCoinToLastMatch)
- -- Reset Coin Gain Last Match when a new match starts
- local RoundStartEvent = game.ReplicatedStorage.Remotes.Gameplay.RoundStart
- RoundStartEvent.OnClientEvent:Connect(resetCoinGainLastMatch)
- end)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement