Im trying to prepare a resource gethering mechanic from environment such as from tree. At 49th line i am getting the error that i mentioned at title.
Also is there easier way to make item drop? I just want that Log piece drop to ground so i can pick it to my inventory.
This is the ServerStorage part at Explorer: https://imgur.com/W8mHvXH
And this is what happens after progress bar completed: https://imgur.com/Hh8fjy9
local Player= game:GetService("Players").LocalPlayer local Char = Player.Character local Cursor = Player:GetMouse() local Gather = true local Items = { "Log"; "Stone"; } local ServerStorage = game:GetService("ServerStorage") local Drops = ServerStorage:FindFirstChild("Drops") function ShowProgress(resource) if resource == 'Tree' then for i = 0,1, .01 do RG.BG.Bar.Progress.Size = UDim2.new(i,0,1,0) wait() end elseif resource == 'Rock' then for i = 0,1, .005 do RG.BG.Bar.Progress.Size = UDim2.new(i,0,1,0) wait() end end end Cursor.Button1Down:connect(function() local Char = Player.Character or Player.CharacterAdded:Wait() if Cursor.Target ~= nil and Cursor.Target.Parent.Name == 'Tree' and Gather == true then local Wood = Cursor.Target if (Wood.Position - Char.HumanoidRootPart.Position).magnitude <10 then Gather = false RG = Player.PlayerGui.Gathering RG.BG.Visible = true Char.Humanoid.WalkSpeed = 0 ShowProgress('Tree') Char.Humanoid.WalkSpeed = 16 for i,v in pairs(Wood.Parent.Leaves:GetChildren()) do if v:IsA('Part') then v.Anchored = false end end Wood:Destroy() --Drop Wood local source = Items[1] local Clone = Drops:FindFirstChild(source):Clone() Clone.Parent = workspace Clone.CFrame =Wood.Cframe * CFrame.new(0,2,0) RG.BG.Visible = false Gather = true end end if Cursor.Target ~= nil and Cursor.Target.Name == 'Rock' and Gather == true then local Rock = Cursor.Target if (Rock.Position - Char.HumanoidRootPart.Position).magnitude <10 then Gather = false RG = Player.PlayerGui.Gathering RG.BG.Visible = true Char.Humanoid.WalkSpeed = 0 ShowProgress('Rock') Char.Humanoid.WalkSpeed = 16 Rock:Destroy() --Drop Stone RG.BG.Visible = false Gather = true end end end)
local source = Items[1] if not Drops:FindFirstChild(source) then return -- check if have,i know it has but verify, if not have then return local Clone = Drops[source]:Clone() -- here now you get and not Find Clone.Parent,Clone.CFrame = workspace,Wood.Cframe * CFrame.new(0,2,0) -- You Can Use This, A,B = 1,0