I need help coding a shop I want it leaderstats not as a individual cash

So I’m trying to make a shop it saves and everything, but the problem is I’m trying to put a daily reward system and the tutorials are “Leaderstats” so I’m trying to change this to leaderstats but I don’t know how- here’s the code:

`local player = game.Players.LocalPlayer

local shop = script.Parent:WaitForChild(“Shop”)

– Functions
function createShopTemplate(itemName,itemPrice,object,parent)

local template = script:WaitForChild("Template"):Clone()
template.Name = itemName
template.ItemName.Text = itemName
template.Price.Text = "$"..itemPrice

local previewedObject = object:Clone(); previewedObject.Parent = template.ViewportFrame

local ori = 0

local cam = Instance.new("Camera"); cam.Parent = template.ViewportFrame

cam.CFrame = CFrame.new(object.Handle.Position + (object.Handle.CFrame.lookVector * 5), object.Handle.Position)

template.ViewportFrame.CurrentCamera = cam

template.Parent = parent

spawn(function()
	while wait() do
		ori += 1
		previewedObject.Handle.Orientation = Vector3.new(0,ori,0)
	end
end)

return template

end

– Update the coins
game:GetService(“RunService”).RenderStepped:Connect(function()

-- You need to change it, to your own curreny name

shop.ShopButton.MoneyText.Text = "$"..player.Coins.Value

end)

shop.ShopButton.ImageButton.MouseButton1Click:Connect(function()
shop.ShopFrame.Visible = not shop.ShopFrame.Visible
shop.ShopButton.MoneyText.Visible = not shop.ShopButton.MoneyText.Visible
end)

game.ReplicatedStorage.Events.SendData.OnClientEvent:Connect(function()
– Sort
local orderedWeapons = {}

for i,v in pairs(game.ReplicatedStorage.Weapons:GetChildren()) do
	table.insert(orderedWeapons,v)
end

table.sort(orderedWeapons,function(a,b) return a:GetAttribute("Price") < b:GetAttribute("Price") end)

-- Shop
for i,v in pairs(orderedWeapons) do
	local frame = createShopTemplate(v.Name,v:GetAttribute("Price"),v,shop.ShopFrame.ScrollingFrame)
	
	if player.Inventory:FindFirstChild(v.Name) then
		frame.Price.Text = "Owned"
		frame.BuyButton.Text = "Equip"
		frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,255,0)
		frame.BuyButton.BorderColor3 = Color3.fromRGB(255,255,200)
	end
	
	if player.EquippedWeapon.Value == v.Name then
		frame.Price.Text = "Equipped"
		frame.BuyButton.Text = "Unequip"
		frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,85,0)
		frame.BuyButton.BorderColor3 = Color3.fromRGB(255,0,0)
	end
	
	frame.BuyButton.MouseButton1Click:Connect(function()
		local result = game.ReplicatedStorage.Events.Buy:InvokeServer(v.Name)
		
		if result == "Brought" or result == "Unequip" then
			frame.Price.Text = "Owned"
			frame.BuyButton.Text = "Equip"
			frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,255,0)
			frame.BuyButton.BorderColor3 = Color3.fromRGB(255,255,200)
		elseif result == "NotEnough" then
			frame.BuyButton.Text = "Not Enough Coins!"
			frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,0,0)
			frame.BuyButton.BorderColor3 = Color3.fromRGB(255,0,0)
			wait(.5)
			frame.BuyButton.Text = "Buy"
			frame.BuyButton.BackgroundColor3 = Color3.fromRGB(0,255,0)
			frame.BuyButton.BorderColor3 = Color3.fromRGB(0,125,0)
		elseif result == "Equip" then
			
			for _,obj in pairs(shop.ShopFrame.ScrollingFrame:GetChildren()) do
				if obj:IsA("Frame") then
					if player.Inventory:FindFirstChild(obj.Name) then
						
						obj.Price.Text = "Owned"
						obj.BuyButton.Text = "Equip"
						obj.BuyButton.BackgroundColor3 = Color3.fromRGB(255,255,0)
						obj.BuyButton.BorderColor3 = Color3.fromRGB(255,255,200)
						
					end
				end
			end
			
			frame.Price.Text = "Equipped"
			frame.BuyButton.Text = "Unequip"
			frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,85,0)
			frame.BuyButton.BorderColor3 = Color3.fromRGB(255,0,0)
		end
	end)
end

end)`

This is the correct format of the script (I didn’t change anything!):

local player = game.Players.LocalPlayer

local shop = script.Parent:WaitForChild("Shop")

-- Functions
function createShopTemplate(itemName,itemPrice,object,parent)

	local template = script:WaitForChild("Template"):Clone()
	template.Name = itemName
	template.ItemName.Text = itemName
	template.Price.Text = "$"..itemPrice

	local previewedObject = object:Clone(); previewedObject.Parent = template.ViewportFrame

	local ori = 0

	local cam = Instance.new("Camera"); cam.Parent = template.ViewportFrame

	cam.CFrame = CFrame.new(object.Handle.Position + (object.Handle.CFrame.lookVector * 5), object.Handle.Position)

	template.ViewportFrame.CurrentCamera = cam

	template.Parent = parent

	spawn(function()
		while wait() do
			ori += 1
			previewedObject.Handle.Orientation = Vector3.new(0,ori,0)
		end
	end)

	return template
end

-- Update the coins
game:GetService("RunService").RenderStepped:Connect(function()

	-- You need to change it, to your own curreny name

	shop.ShopButton.MoneyText.Text = "$"..player.Coins.Value
end)

shop.ShopButton.ImageButton.MouseButton1Click:Connect(function()
	shop.ShopFrame.Visible = not shop.ShopFrame.Visible
	shop.ShopButton.MoneyText.Visible = not shop.ShopButton.MoneyText.Visible
end)

game.ReplicatedStorage.Events.SendData.OnClientEvent:Connect(function()
	-- Sort
	local orderedWeapons = {}

	for i,v in pairs(game.ReplicatedStorage.Weapons:GetChildren()) do
		table.insert(orderedWeapons,v)
	end

	table.sort(orderedWeapons,function(a,b) return a:GetAttribute("Price") < b:GetAttribute("Price") end)

	-- Shop
	for i,v in pairs(orderedWeapons) do
		local frame = createShopTemplate(v.Name,v:GetAttribute("Price"),v,shop.ShopFrame.ScrollingFrame)

		if player.Inventory:FindFirstChild(v.Name) then
			frame.Price.Text = "Owned"
			frame.BuyButton.Text = "Equip"
			frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,255,0)
			frame.BuyButton.BorderColor3 = Color3.fromRGB(255,255,200)
		end

		if player.EquippedWeapon.Value == v.Name then
			frame.Price.Text = "Equipped"
			frame.BuyButton.Text = "Unequip"
			frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,85,0)
			frame.BuyButton.BorderColor3 = Color3.fromRGB(255,0,0)
		end

		frame.BuyButton.MouseButton1Click:Connect(function()
			local result = game.ReplicatedStorage.Events.Buy:InvokeServer(v.Name)

			if result == "Brought" or result == "Unequip" then
				frame.Price.Text = "Owned"
				frame.BuyButton.Text = "Equip"
				frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,255,0)
				frame.BuyButton.BorderColor3 = Color3.fromRGB(255,255,200)
			elseif result == "NotEnough" then
				frame.BuyButton.Text = "Not Enough Coins!"
				frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,0,0)
				frame.BuyButton.BorderColor3 = Color3.fromRGB(255,0,0)
				wait(.5)
				frame.BuyButton.Text = "Buy"
				frame.BuyButton.BackgroundColor3 = Color3.fromRGB(0,255,0)
				frame.BuyButton.BorderColor3 = Color3.fromRGB(0,125,0)
			elseif result == "Equip" then

				for _,obj in pairs(shop.ShopFrame.ScrollingFrame:GetChildren()) do
					if obj:IsA("Frame") then
						if player.Inventory:FindFirstChild(obj.Name) then

							obj.Price.Text = "Owned"
							obj.BuyButton.Text = "Equip"
							obj.BuyButton.BackgroundColor3 = Color3.fromRGB(255,255,0)
							obj.BuyButton.BorderColor3 = Color3.fromRGB(255,255,200)

						end
					end
				end

				frame.Price.Text = "Equipped"
				frame.BuyButton.Text = "Unequip"
				frame.BuyButton.BackgroundColor3 = Color3.fromRGB(255,85,0)
				frame.BuyButton.BorderColor3 = Color3.fromRGB(255,0,0)
			end
		end)
	end
end)

thanks it messed up as I did the " ` "