local pickaxe = script.Parent
local canmine = pickaxe.CanMine
local anim = pickaxe.Animation
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character
local animtrack
local humanoid
player.CharacterAdded:Connect(function(character)
humanoid = character:WaitForChild("Humanoid")
animtrack = humanoid:LoadAnimation(anim)
end)
canmine.Value = true
pickaxe.Activated:Connect(function()
if canmine.Value == true then
print("activated")
animtrack:Play()
canmine.Value = false
pickaxe.Touched:Connect(function(hit)
if hit.Name == "Rock" or hit.Parent == "Rocks" then
print("mining")
end
end)
task.wait(1)
canmine.Value = true
end
end)
I have a script for a mining system in my game. If the pickaxe touched the rock then it will print “mining” in the output, but it returns an error saying “Touched is not a valid member of Tool “Workspace.player_name.Pickaxe””. Im new at scripting so, i don’t really know how to fix this. Can anyone help?