How Do I Make An Automine Pickaxe?
Okay, I I Have A Mining Script For A Pickaxe That I Made, So How Do I Make It Go Automatic Without Wrecking The Script?
001 | local tType = script.Parent:FindFirstChild( "TType" ) |
002 | local count = tType:FindFirstChild( "Count" ).Value |
003 | local range = tType:FindFirstChild( "Range" ).Value |
004 | local damage = tType:FindFirstChild( "Damage" ).Value |
005 | local coolDown = tType:FindFirstChild( "coolDown" ).Value |
009 | local plr = game.Players.LocalPlayer |
010 | repeat wait() until plr.Character ~ = nil |
011 | local mouse = plr:GetMouse() |
012 | local rs = game:GetService( 'ReplicatedStorage' ) |
013 | local events = rs.Events |
014 | local st = plr:WaitForChild( "Settings" ) |
015 | local blocks = st:WaitForChild( "Blocks" ) |
016 | local char = plr.Character |
020 | pack = char:FindFirstChild( "Backpack" ) |
021 | area = pack:FindFirstChild( "MaxArea" ) |
027 | mouse.Button 1 Down:Connect( function () |
031 | mouse.Button 1 Up:Connect( function () |
037 | while wait(coolDown) do |
039 | pack = char:FindFirstChild( "Backpack" ) |
040 | area = pack:FindFirstChild( "MaxArea" ) |
041 | if script.Parent.Parent.Name ~ = "Backpack" and script.Parent.Parent.Name = = plr.Name then |
042 | if mouse.Target and mouse.Target.Parent.Name = = "Ore" then |
043 | local mag = (mouse.Target.Position-plr.Character.HumanoidRootPart.Position).magnitude |
045 | if mouse.Target and mouse.Target.Parent.Name = = "Ore" then |
046 | plr.PlayerGui.BlockInfo.Enabled = true |
047 | plr.PlayerGui.SelectionBox.Color 3 = Color 3. new( 0 , 255 , 0 ) |
048 | plr.PlayerGui.SelectionBox.Adornee = mouse.Target |
049 | if mouse.Target.CurrentDamage.Value/mouse.Target.Damage.Value > 1 then |
050 | plr.PlayerGui.BlockInfo.Frame.Fill.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
052 | plr.PlayerGui.BlockInfo.Frame.Fill.Size = UDim 2. new(mouse.Target.CurrentDamage.Value/mouse.Target.Damage.Value, 0 , 1 , 0 ) |
054 | plr.PlayerGui.BlockInfo.Frame.BlockName.Text = mouse.Target.Name.. " - " ..mouse.Target.Count.Value |
055 | plr.PlayerGui.BlockInfo.Frame.Value.Text = "Value: " ..mouse.Target.Coin.Value |
057 | plr.PlayerGui.BlockInfo.Enabled = false |
058 | plr.PlayerGui.SelectionBox.Adornee = nil |
059 | script.Parent.Handle.Breaking:Stop() |
062 | if (area.Value-blocks.Value) > 0 then |
064 | if plr.PlayerGui:FindFirstChild( "Sell/Upgrade" ) then |
065 | plr.PlayerGui:FindFirstChild( "Sell/Upgrade" ).Frame.Visible = true |
068 | if mouse.Target and mouse.Target.Parent.Name = = "Ore" then |
069 | if mouse.Target.CurrentDamage.Value > = mouse.Target.Damage.Value then |
070 | events.Break:FireServer(mouse.Target,count) |
071 | mouse.Target.CurrentDamage.Value = 0 |
072 | script.Parent.Handle.Breaking:Stop() |
074 | mouse.Target.CurrentDamage.Value = mouse.Target.CurrentDamage.Value + damage |
075 | if script.Parent.Handle.Breaking.Playing = = false then |
076 | script.Parent.Handle.Breaking:Play() |
080 | for i,v in pairs (workspace.Ore:GetChildren()) do |
081 | if v ~ = mouse.Target then |
082 | if v:FindFirstChild( "CurrentDamage" ) = = nil then |
085 | v:FindFirstChild( "CurrentDamage" ).Value = 0 |
090 | script.Parent.Handle.Breaking:Stop() |
091 | for i,v in pairs (workspace.Ore:GetChildren()) do |
092 | if v:FindFirstChild( "CurrentDamage" ) = = nil then |
095 | v:FindFirstChild( "CurrentDamage" ).Value = 0 |
100 | plr.PlayerGui.BlockInfo.Enabled = true |
101 | plr.PlayerGui.SelectionBox.Color 3 = Color 3. new( 255 , 0 , 0 ) |
102 | plr.PlayerGui.SelectionBox.Adornee = mouse.Target |
103 | plr.PlayerGui.BlockInfo.Frame.Fill.Size = UDim 2. new( 0 , 0 , 1 , 0 ) |
104 | plr.PlayerGui.BlockInfo.Frame.BlockName.Text = "Out of range!" |
105 | plr.PlayerGui.BlockInfo.Frame.Value.Text = "Value: " .. 0 |
106 | script.Parent.Handle.Breaking:Stop() |
107 | for i,v in pairs (workspace.Ore:GetChildren()) do |
108 | if v:FindFirstChild( "CurrentDamage" ) = = nil then |
111 | v:FindFirstChild( "CurrentDamage" ).Value = 0 |
115 | elseif mouse.Target and mouse.Target.Parent.Parent.Name = = "Ore" then |
116 | local mag = (mouse.Target.Parent.Position-plr.Character.HumanoidRootPart.Position).magnitude |
118 | if mouse.Target.Parent and mouse.Target.Parent.Parent.Name = = "Ore" then |
119 | plr.PlayerGui.BlockInfo.Enabled = true |
120 | plr.PlayerGui.SelectionBox.Color 3 = Color 3. new( 0 , 255 , 0 ) |
121 | plr.PlayerGui.SelectionBox.Adornee = mouse.Target.Parent |
122 | if mouse.Target.Parent.CurrentDamage.Value/mouse.Target.Parent.Damage.Value > 1 then |
123 | plr.PlayerGui.BlockInfo.Frame.Fill.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
125 | plr.PlayerGui.BlockInfo.Frame.Fill.Size = UDim 2. new(mouse.Target.Parent.CurrentDamage.Value/mouse.Target.Parent.Damage.Value, 0 , 1 , 0 ) |
127 | plr.PlayerGui.BlockInfo.Frame.BlockName.Text = mouse.Target.Parent.Name.. " - " ..mouse.Target.Parent.Count.Value |
128 | plr.PlayerGui.BlockInfo.Frame.Value.Text = "Value: " ..mouse.Target.Parent.Coin.Value |
130 | plr.PlayerGui.BlockInfo.Enabled = false |
131 | plr.PlayerGui.SelectionBox.Adornee = nil |
132 | script.Parent.Handle.Breaking:Stop() |
135 | if (area.Value-blocks.Value) > 0 then |
137 | if plr.PlayerGui:FindFirstChild( "Sell/Upgrade" ) then |
138 | plr.PlayerGui:FindFirstChild( "Sell/Upgrade" ).Frame.Visible = true |
141 | if mouse.Target.Parent and mouse.Target.Parent.Parent.Name = = "Ore" then |
142 | if mouse.Target.Parent.CurrentDamage.Value > = mouse.Target.Parent.Damage.Value then |
143 | events.Break:FireServer(mouse.Target.Parent,count) |
144 | mouse.Target.Parent.CurrentDamage.Value = 0 |
145 | script.Parent.Handle.Breaking:Stop() |
147 | mouse.Target.Parent.CurrentDamage.Value = mouse.Target.Parent.CurrentDamage.Value + damage |
148 | if script.Parent.Handle.Breaking.Playing = = false then |
149 | script.Parent.Handle.Breaking:Play() |
153 | for i,v in pairs (workspace.Ore:GetChildren()) do |
154 | if v ~ = mouse.Target.Parent then |
155 | if v:FindFirstChild( "CurrentDamage" ) = = nil then |
158 | v:FindFirstChild( "CurrentDamage" ).Value = 0 |
163 | script.Parent.Handle.Breaking:Stop() |
164 | for i,v in pairs (workspace.Ore:GetChildren()) do |
165 | if v:FindFirstChild( "CurrentDamage" ) = = nil then |
168 | v:FindFirstChild( "CurrentDamage" ).Value = 0 |
173 | plr.PlayerGui.BlockInfo.Enabled = true |
174 | plr.PlayerGui.SelectionBox.Color 3 = Color 3. new( 255 , 0 , 0 ) |
175 | plr.PlayerGui.SelectionBox.Adornee = mouse.Target.Parent |
176 | plr.PlayerGui.BlockInfo.Frame.Fill.Size = UDim 2. new( 0 , 0 , 1 , 0 ) |
177 | plr.PlayerGui.BlockInfo.Frame.BlockName.Text = "Out of range!" |
178 | plr.PlayerGui.BlockInfo.Frame.Value.Text = "Value: " .. 0 |
179 | script.Parent.Handle.Breaking:Stop() |
180 | for i,v in pairs (workspace.Ore:GetChildren()) do |
181 | if v:FindFirstChild( "CurrentDamage" ) = = nil then |
184 | v:FindFirstChild( "CurrentDamage" ).Value = 0 |
189 | plr.PlayerGui.BlockInfo.Enabled = false |
190 | plr.PlayerGui.SelectionBox.Adornee = nil |
191 | script.Parent.Handle.Breaking:Stop() |
192 | for i,v in pairs (workspace.Ore:GetChildren()) do |
193 | if v:FindFirstChild( "CurrentDamage" ) = = nil then |
196 | v:FindFirstChild( "CurrentDamage" ).Value = 0 |
201 | plr.PlayerGui.BlockInfo.Enabled = false |
202 | plr.PlayerGui.SelectionBox.Adornee = nil |
203 | script.Parent.Handle.Breaking:Stop() |