Localscript in tool
local tool = script.Parent
local plr = tool.Parent.Parent
local mouse = plr:GetMouse()
local Crystals = game.Workspace.Crystals
local c = plr.Character --here
local hum = c.Humanoid --here
local storage = game.ReplicatedStorage.CrystalStorage
local RegenTime = math.random(5,10)
local period = math.random(4,15)
game.Workspace.Area.Touched:connect(function(plr)
local function onActivate()
if mouse.Target.Name == "Crystal" then
mouse.Target.Owner.Value = c
local a = hum:LoadAnimation(tool.Handle.Animation)
a:Play()
wait(period)
a:Stop()
for i,a in pairs(game.Workspace.Crystals:GetChildren()) do
if a:IsA("UnionOperation") then
if a.Owner.Value == c then
a.Parent = storage
wait(RegenTime)
a.Parent = Crystals
a.Owner.Value = nil
end
end
end
end
end
tool.Activated:connect(onActivate)
end)

3 comments
20:52:52.215 - Players.Player1.Backpack.Pickaxe.LocalScript:4: attempt to index local 'c' (a nil value)
ahhh messy code
Good for giving the entire error in comments, bravo!