local o=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local T=game:GetService("\080\108\097\121\101\114\115")local m=T.LocalPlayer local M=o:WaitForChild("\108\105\098")local N=o:WaitForChild("\099\111\109\109\111\110")local y=script local k=require(M:WaitForChild("\082\111\097\099\116"))local f=require(M:WaitForChild("\082\111\097\099\116\082\111\100\117\120"))local P=require(N:WaitForChild("\083\101\108\101\099\116\111\114\115"))local V=require(y:WaitForChild("\083\116\097\116\067\111\117\110\116\101\114"))local B=.25 local W=300 local n=k.Component:extend("\083\116\097\116\070\114\097\109\101")function n.render(o)return k.createElement("\070\114\097\109\101",{Name="\083\116\097\116\070\114\097\109\101",Position=UDim2.new(0,32,.5,0);Size=UDim2.new(0,300,0,300),AnchorPoint=Vector2.new(0,.5),BackgroundTransparency=1},{scale=k.createElement("\085\073\083\099\097\108\101",{Scale=math.min(1,(o.props.viewportSize.X*B)/W)}),layout=k.createElement("\085\073\076\105\115\116\076\097\121\111\117\116",{SortOrder=Enum.SortOrder.LayoutOrder;VerticalAlignment=Enum.VerticalAlignment.Center;Padding=UDim.new(0,16)}),coinCounter=k.createElement(V,{iconImage="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\048\050\053\057\052\053\053\052\050";statName="\067\111\105\110\115\058 \036",value=o.props.coins;layoutOrder=1});candyCounter=k.createElement(V,{iconImage="\114\098\120\097\115\115\101\116\105\100\058\047\047\053\053\054\048\052\055\054\048\049";statName="\067\097\110\100\121\058 ",value=o.props.candy,layoutOrder=2})})end local function F(o,T)local M=P.getStats(o,m)return{coins=M.coins or 0;candy=M.candy or 0}end n=(f.connect(F,nil))(n)return n
-- displays coins and other counters
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

local lib = ReplicatedStorage:WaitForChild("lib")
local common = ReplicatedStorage:WaitForChild("common")

local component = script

local Roact = require(lib:WaitForChild("Roact"))
local RoactRodux = require(lib:WaitForChild("RoactRodux"))
local Selectors = require(common:WaitForChild("Selectors"))
local StatCounter = require(component:WaitForChild("StatCounter"))

local TARGET_AXIS_SCALE = 1/4
local PIXEL_SIZE = 300

local StatFrame = Roact.Component:extend("StatFrame")

function StatFrame:render()
    return Roact.createElement("Frame", {
        Name = "StatFrame",
        Position = UDim2.new(0,32,0.5,0),
        Size = UDim2.new(0,300,0,300),
        AnchorPoint = Vector2.new(0,0.5),
        BackgroundTransparency = 1,
    }, {
        scale = Roact.createElement("UIScale", {
            Scale = math.min(1,(self.props.viewportSize.X * TARGET_AXIS_SCALE)/PIXEL_SIZE)
        }),
        layout = Roact.createElement("UIListLayout",{
            SortOrder = Enum.SortOrder.LayoutOrder,
            VerticalAlignment = Enum.VerticalAlignment.Center,
            Padding = UDim.new(0,16),
        }),
        coinCounter = Roact.createElement(StatCounter,{
            iconImage = "rbxassetid://1025945542",
            statName = "Coins: $",
            value = self.props.coins,
            layoutOrder = 1,
        }),
        candyCounter = Roact.createElement(StatCounter,{
            iconImage = "rbxassetid://556047601",
            statName = "Candy: ",
            value = self.props.candy,
            layoutOrder = 2,
        }),
    })
end

local function mapStateToProps(state,props)
    local stats = Selectors.getStats(state, LocalPlayer)
    return {
        coins = stats.coins or 0,
        candy = stats.candy or 0,
    }
end

StatFrame = RoactRodux.connect(mapStateToProps,nil)(StatFrame)

return StatFrame