I am making a mining script and it is supposed to run when the player presses Button1, but nothing happens. Here is the script:

--LocalScript
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local Mining = false
local Strength = player.Strength
function Xplo()
	Mouse.Target.Xplo.Enabled = true
	wait(0.1)
	Mouse.Target.Xplo.Enabled = false
end

Mouse.Button1Down:connect(function()
	Mining = true
	while true do
		wait(0.1)
		if Mining == true then
			Mouse.Target.Durability.Value = Mouse.Target.Durability.Value - Strength
			Mouse.Target.Break.Durabilty.Visible = true
			if Mouse.Target.Durability.Value <= 0 then
				local Dropz = Mouse.Target.Drop.Value
				Mouse.Target.BottomImage:Destroy()
				Mouse.Target.FrontImage:Destroy()
				Mouse.Target.BackImage:Destroy()
				Mouse.Target.LeftImage:Destroy()
				Mouse.Target.RightImage:Destroy()
				Mouse.Target.TopImage:Destroy()
				Mouse.Target.Transparency = 1
				Xplo()
				local Item = game.ServerStorage.Dropz:Clone()
				local pos = Mouse.Target.Position
				Item.Position = Vector3.new(pos)
				Mouse.Target:Destroy()
			end
		end
	end
end)

Mouse.Button1Up:connect(function()
	Mining = false
	Mouse.Target.Durability.Value = Mouse.Target.FirstDura.Value
	Mouse.Target.Break.Durabilty.Visible = false
end)

5 comments

0

Are there any errors when you play the game in Roblox Studio?

0

You don't know what Mouse.Target is yet! Check it prior to attempting to manipulate it.

0

No errors. Have you also read the wiki about Mouse.Target? It is the object the mouse is pointing to. I am pointing to a part that has every single one of these things.

0

I dont get what you mean and what the point of the script does

0

So then your not a scripter