local LevelReq = script.Parent:WaitForChild("LevelReq").Value
local Price = script.Parent:WaitForChild("Price").Value
script.Parent.MouseButton1Click:Connect(function()
local Player = game.Players.LocalPlayer
local Stats = Player:WaitForChild("leaderstats")
local Level = Stats:WaitForChild("Level")
local Gold = Stats:WaitForChild("Gold")
local Tool = script.Parent.Item.Value
local CTool = game.ReplicatedStorage.ToolLibrary:FindFirstChild(Tool):Clone()
if Player.Backpack:FindFirstChild(Tool) or Player.Character:FindFirstChild(Tool) then return end
if Level.Value >= LevelReq then
if Gold.Value >= Price then
Gold.Value = Gold.Value - Price
CTool.Parent = Player.Backpack
end
end
end)
script.Parent.MouseEnter:Connect(function()
local Cost = script.Parent.Parent.Parent:WaitForChild("Cost")
Cost.Text = "Cost: 3"..Price
end)
script.Parent.MouseLeave:Connect(function()
local Cost = script.Parent.Parent.Parent:WaitForChild("Cost")
Cost.Text = "Cost:"
end)
I've been pulling my hair out trying to fix the error on Line 10, the shop I've made opens and closes, just buying a tool is the part that doesn't work.

2 comments
Thank you very much! Gosh, I seem really stupid for not realizing that error there.
Don't worry, i'm here to help