Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Pickaxe script wont mine any ore that I click on. This is a local script Help?[SOLVED]

--Variables
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()

--Mining
mouse.Button1Down(function()
	if mouse.Target == nil then return end
	if mouse.Target == 'Rock'  then
		mouse.Target.Ore:remove()
	end
end)

mouse.Button1Down:connect()

It will not remove the ore once i click.

8 comments

0

Output error:21:17:43.283 - Players.Player1.Backpack.PickAxe.PickAxeScript:6: attempt to call field 'Button1Down' (a userdata value)

0

At line 06 put mouse.Button1Down:connect(function()

0

It still will not work.

0

What is the output?

0

:Remove is deprecated also use :Destroy() instead

0

:Destroy still does not destroy the ore. It also doesn't show any errors in the output.

0

Remove line 7

0

still doesnt work

1 answer

Fixed here is the script:


local tool = script.Parent
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()


tool.Equipped:connect(function()
	tool.Activated:connect(function(Mine)
		if mouse.Target == game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock or game.Workspace.Rock then
			mouse.Target.Ore:Destroy()
			return Mine
		elseif mouse.Target ~= game.Workspace.Rock then
			return Mine
		end
	end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.