So, I made a script (with help from youtube tutorials, like @Alvin_Blox’s) that gives players tools when purchased a tool. It was doing well a few months ago then suddenly, it stopped working properly today. So yeah, every time I click my buy button, it doesn’t give me items.
Here’s the script(Please tell me if I made some mistakes here.):
local folder = game.ReplicatedStorage:WaitForChild("Tools")
local frame = script.Parent:WaitForChild("Frame")
local template = frame:WaitForChild("Template")
local button = script.Parent:WaitForChild("Button")
for _, tool in pairs (folder:GetChildren()) do
local newTemplate = template:Clone()
newTemplate.Name = tool.Name
newTemplate.ObjectName.Text = tool.Name
newTemplate.Visible = true
newTemplate.Parent = frame
local object = tool:Clone()
object.Parent = newTemplate.ViewportFrame
local camera = Instance.new("Camera")
camera.CFrame = CFrame.new(object.Handle.Position + (object.Handle.CFrame.lookVector*5)+Vector3.new(1,2,1),object.Handle.Position)
camera.Parent = newTemplate.ViewportFrame
newTemplate.ViewportFrame.CurrentCamera = camera
newTemplate.MouseButton1Click:Connect(function()
local result = game.ReplicatedStorage.BuyItem:InvokeServer(tool.Name)
if result == true then
newTemplate.BackgroundColor3 = Color3.fromRGB(116, 255, 92)
else
newTemplate.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
end
wait(1)
newTemplate.BackgroundColor3 = Color3.fromRGB(188, 255, 110)
end)
end
button.MouseButton1Click:Connect(function()
frame.Visible = not frame.Visible
script.Parent.Header.Visible = not script.Parent.Header.Visible
end)
Screenshot of the Gui (could help you):

