Im not sure if this relevant, so bear with me. I’ve been coding legitimately for about 1-2 months. And during this time I had the necessary knowledge to make a trail system, which I was almost finished with. Then I came across a problem, I couldn’t figure out how to make an equip and unequip work, so I asked what chat gpt thought of it when I first heard about it, and I asked it to fix my code. I will tell that I was surprised, little after reading it and applying it, the code chat gpt revised worked perfectly, which made me very discouraged, and I’m not sure what to say, maybe I can learn from this experience.
Here’s my code for equipping
local repstorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local equipped = false
for index, value in pairs(script.Parent.TrailFolder:GetChildren()) do
if value:IsA("TextButton") then
value.MouseButton1Click:Connect(function()
if player.leaderstats.Coins.Value >= value.Price.Value and equipped == false then
value.Text = "Equipped"
equipped = true
repstorage.TrailRemote:FireServer(value.Name, equipped)
else
if equipped == true then
equipped = false
value.Text = "Equip"
repstorage.TrailRemote:FireServer(value.Name, equipped)
end
end
end)
end
end
Chat gpt code for equipping
local repstorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
for index, value in pairs(script.Parent.TrailFolder:GetChildren()) do
if value:IsA("TextButton") then
value.MouseButton1Click:Connect(function()
if player.leaderstats.Coins.Value >= value.Price.Value then
-- If the button is already equipped, unequip it
if value.Text == "Equipped" then
value.Text = "Equip"
value.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
repstorage.TrailRemote:FireServer(value.Name)
else
-- Reset the text and appearance of all buttons
for _, button in pairs(script.Parent.TrailFolder:GetChildren()) do
if button:IsA("TextButton") then
button.Text = "Equip"
button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end
end
-- Set the text and appearance of the clicked button
value.Text = "Equipped"
value.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
-- Fire the TrailRemote object with the name of the clicked button as a parameter
repstorage.TrailRemote:FireServer(value.Name)
end
end
end)
end
end
Although after reading its not hard to understand, I was just very discouraged that I couldn’t figure it out. I just want to know what you guys think and maybe give some encouragement to keep going.
Although I’m discourage, I want to encourage you guys to never give up, I know it sounds cliché, but its true.