local player = game.Players.LocalPlayer
local character = game.Workspace[player.Name].Humanoid
local inventory = player.PlayerGui.ScreenGui.Pages.Inventory
local itemsforinventory = game.ServerStorage.ItemsForInventory
local mouse = player:GetMouse()
local gathering = false
script.Parent.Activated:connect(function()
local target = mouse.Target
local playerwalkspeed = character.WalkSpeed
local range = player:DistanceFromCharacter(target.Position)
if not gathering and script.Parent.Parent.Name == player.Name and target.Name == "FoliageLarge" or target.Name == "Apple" or target.Name == "WoodTree" or target.Name == "StoneLarge" or target.Name == "StoneMedium" or target.Name == "StoneSmall" or target.Name == "Orange" then
if range <= 30 and player.PlayerGui.ScreenGui.Pages.Inventory.ItemsInInventory.Value < 40 then
gathering = true
script.Disabled = true
character.WalkSpeed = 0
wait(target.GatherTime.Value)
target:Remove()
player.PlayerGui.ScreenGui.Pages.Inventory.ItemsInInventory.Value = player.PlayerGui.ScreenGui.Pages.Inventory.ItemsInInventory.Value + 1
print(player.Name.." has gathered a "..target.Name)
script.Disabled = false
character.WalkSpeed = playerwalkspeed
local itemgui = itemsforinventory[target.Name][target.Name..'Gui']:Clone()
itemgui.Parent = player.PlayerGui.ScreenGui.Pages.Inventory
gathering = false
end
end
end)
I used to have a file with the working code but it was lost ;-; There's no error. Before, the player would click say an apple then they'd stop for the specified gather time, it'd go into their inventory, and that would be that. Nothing happens now. Help is much appreciated.

3 comments
Once you disable a script (which I don't recommend doing), you can't enable it from that script. because it's disabled.
I'd put print statements to show when lines 6 and 8 are running (if at all). If both are running at the expected time, print out the value of relevant variables for line 11 and go from there.
Why do I see print(player.name.." has gathered a "..target.Name) because I do not think that the 2 extra dots, next to the quotation marks would cause the error, instead of process the script itself creating an error. " script.Disabled = true " Why do you have all of those names? Why would you set the walkspeed to 0?? Removing the target prevents it from cloning... I think I see a lot of issues.