generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Hold and mine script?

Previous Thread :: Next Thread 
Lo202 is not online. Lo202
Joined: 31 Jan 2013
Total Posts: 579
14 Dec 2015 02:13 AM
Why can't I hold and dig? I wanna make one like quarry.

wait(0)

local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServiceModule = ReplicatedStorage.ServiceModule

-- Retrieve server modules required

local wait = require(ServiceModule.WaitModule)
local crypt = require(ServiceModule.CryptModule)

local Player = Players.LocalPlayer
local Backpack = Player.Backpack
local PlayerGui = Player.PlayerGui
local Animated = Backpack:FindFirstChild("ReAnimate")
local gui = PlayerGui:FindFirstChild("GameGUI")

-- Reanimate the pickaxe (fix animation not working)

if not Animated.Value then
local p = script.Parent:FindFirstChild("Active")
if p then
p.Disabled = false
Workspace.Generation.AnimateFix:InvokeServer()
end
end

-- Setting vars for stuff

local debounce = true
local checkPad = false
local confirmDig = false
local activePick = false
local isMining = false
local invFull = false
local cancel = false
local success = false
local enc1 = {29, 58, 93, 28, 27}

repeat wait() until Player.Character

local plrSpeed = 16
local Humanoid = Player.Character.Humanoid
local Tool = script.Parent
local AnimSlash = Tool.RightSlash
local DigSound = Tool.Handle.Dig
local Settings = Tool.Settings
local Speed = Settings.SpeedWalk
local waitStone = Settings.HitStone
local waitDirt = Settings.HitDirt
local waitOre = Settings.HitOre
local waitGranite = Settings.HitGranite
local waitObsidian = Settings.HitObsidian
local coolDown = Settings.CoolDown
local targetRange = Settings.HitRange

local cGui = PlayerGui["StatsGUI"]
local Inventory = cGui.InventoryFrame.Inventory
local BarInfo = cGui.ProgressFrame.TextBar.TextLabel

local pickSound = "http://www.roblox.com/asset?id=157176648"

repeat wait() until Player:FindFirstChild("Animate")

-- Play RightSlash when animate is true

Player.Animate.Changed:connect(function()
if Player.Animate.Value then
local SlashAnim = Humanoid:LoadAnimation(AnimSlash)
SlashAnim:Play()
end
end)

Workspace.Generation.ToolEffect:InvokeServer()

-- Create a SelectionBox for block selection

local SelectionSurface = Instance.new("SelectionBox")
SelectionSurface.Color = BrickColor.Green()
SelectionSurface.Visible = true
SelectionSurface.Parent = PlayerGui
SelectionSurface.Adornee = nil

function findItem(inv, ore)
if inv:FindFirstChild("En_"..ore) then
return tonumber((crypt(tostring(inv["En_"..ore].Value),enc1,true))) or 0
else return 0
end
end

function checkInventory()
if Inventory.Value >= Inventory.MaxValue then
invFull = true
BarInfo.Text = "INVENTORY IS FULL" BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,35),UDim2.new(0, 0, -1, -5), "Out", "Quad", 0.075, true)
elseif Inventory.Value < Inventory.MaxValue then invFull = false
end
end

local function onMouseButton1Down(mouse)
local target = mouse.Target
local surface = mouse.TargetSurface
local tarRange = (targetRange.Value/2) + 16

checkInventory()
confirmDig = true
checkPad = false

if target and target.Parent == Workspace.BlockField and target.Locked == false then
if target:FindFirstChild("Teled") then
if target["Teled"].Value == Player.Name then
checkPad = true
else
if Players:FindFirstChild(target["Teled"].Value) then
confirmDig = false
end
end
end
if target:FindFirstChild("Claimed") then
if target["Claimed"].Value == Player.Name then
checkPad = true
else
if Players:FindFirstChild(target["Claimed"].Value) then
confirmDig = false
end
end
end
end
if (target and target.Parent == Workspace.BlockField and target.Locked == false and
not target:FindFirstChild("Owner") and
not isMining and
not invFull and
confirmDig) then
if not target.Locked and (target.Position-Tool.Handle.Position).magnitude <= tarRange and debounce then
debounce = false
local hitObj = target.Name
if checkPad then
-- place checkpoint pad
end
isMining = true
if not cancel and Humanoid.Health > 0 then
local SlashAnim = Humanoid:LoadAnimation(AnimSlash)
SlashAnim:Play()
BarInfo.Text = "MINING "..string.upper(target.Name) BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,35),UDim2.new(0, 0, -1, -5), "Out", "Quad", 0.075, true)
Humanoid.WalkSpeed = plrSpeed/3
SelectionSurface.Adornee = target
SelectionSurface.Color = BrickColor.White()
local delay = waitOre.Value
if target.Name == "Stone" then delay = waitStone.Value
elseif target.Name == "Dirt" then delay = waitDirt.Value
elseif target.Name == "Granite" then
if waitGranite.Value == 0 then delay = 1.2 else delay = waitGranite.Value end
elseif target.Name == "Obsidian" then
if waitObsidian.Value == 0 then delay = 2.5 else delay = (waitObsidian.Value * 1.5) end
else delay = waitOre.Value
end
if not target:FindFirstChild("Decal") then
cGui.ProgressFrame.TopBar:TweenSizeAndPosition(UDim2.new(1,0,1,0),UDim2.new(0, 0, 0, 0), "InOut", "Linear", delay*6,true)
local ended = surface
local placed = nil
if target:FindFirstChild("Placed") then
placed = target.Placed.Value
end
Workspace.DigHandler.Claim:InvokeServer(ended, target, delay, placed)
--ServerFunction.DigBlock:InvokeServer(ended,target,delay)
success = true
end
end

if not cancel then
Humanoid.WalkSpeed = plrSpeed
if success and hitObj == target.Name then
--local oldNum = findItem(Player.playerstats.data.inventory,hitObj)
DigSound.Pitch = 1
DigSound.SoundId = pickSound
DigSound:Play()
--BarInfo.Text = string.upper(target.Name).. " x"..tostring(oldNum)
else
BarInfo.Text = "CANNOT MINE THIS BLOCK"
SelectionSurface.Color = BrickColor.Red()
end
elseif cancel or Humanoid.Health == 0 then
Humanoid.WalkSpeed = plrSpeed
local x = target:GetChildren()
for v = 1, #x do
if x[v].Parent == Workspace.BlockField and x[v]:IsA("Decal") or x[v]:IsA("StringValue") then
x[v]:Destroy()
end
end
end
Humanoid.WalkSpeed = plrSpeed
SelectionSurface.Adornee = nil
BarInfo.Text = " " BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,0),UDim2.new(0, 0, 1, -5), "Out", "Quad", 0.3, true)
cGui.ProgressFrame.TopBar:TweenSizeAndPosition(UDim2.new(0,0,1,0),UDim2.new(0.5, 0, 0, 0), "InOut", "Linear", coolDown.Value,true)
wait(coolDown.Value)
debounce = true
isMining = false
end
elseif not isMining and not invFull then
if target and target:FindFirstChild("Owner") then
if target["Owner"].Value ~= Player.Name and Players:FindFirstChild(target["Owner"].Value) then
BarInfo.Text = string.upper(tostring(target["Owner"].Value)).. " IS MINING THIS"
Humanoid.WalkSpeed = plrSpeed
SelectionSurface.Color = BrickColor.Red()
end
elseif target and target:FindFirstChild("Teled") then
if target["Teled"].Value ~= Player.Name and Players:FindFirstChild(target["Teled"].Value) then
BarInfo.Text = string.upper(tostring(target["Teled"].Value)).. "'S CHECKPOINT"
Humanoid.WalkSpeed = plrSpeed
SelectionSurface.Color = BrickColor.Red()
end
elseif target and target:FindFirstChild("Claimed") then
if target["Claimed"].Value ~= Player.Name and Players:FindFirstChild(target["Claimed"].Value) then
BarInfo.Text = string.upper(tostring(target["Claimed"].Value)).. " CLAIMED THIS"
Humanoid.WalkSpeed = plrSpeed
SelectionSurface.Color = BrickColor.Red()
end
elseif target then
local x = target:GetChildren()
Humanoid.WalkSpeed = plrSpeed
for v = 1, #x do
if x[v].Parent == Workspace.BlockField and x[v]:IsA("Decal") or x[v]:IsA("StringValue") then
x[v]:Destroy()
end
end
end
elseif invFull then
BarInfo.Text = "INVENTORY IS FULL" BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,35),UDim2.new(0, 0, -1, -5), "Out", "Quad", 0.075, true)
end
end

local function onMouseMoved(mouse)
checkInventory()

if debounce and not isMining and not invFull then
local target = mouse.Target
local surface = mouse.TargetSurface
local tarRange = (targetRange.Value/2) + 16
if target then
if not target.Locked and (target.Position-Tool.Handle.Position).magnitude <= tarRange then
if target.Anchored then
SelectionSurface.Adornee = target
SelectionSurface.Color = BrickColor.Green()
local owned = target:FindFirstChild("Owner")
local teled = target:FindFirstChild("Teled")
local claim = target:FindFirstChild("Claimed")
if owned and owned.Value ~= Player.Name and Players:FindFirstChild(owned.Value) then
BarInfo.Text = string.upper(tostring(owned.Value)).. " IS MINING THIS"
SelectionSurface.Color = BrickColor.Red()
elseif teled and teled.Value == Player.Name then
BarInfo.Text = "REMOVE CHECKPOINT"
elseif teled and teled.Value ~= Player.Name and Players:FindFirstChild(teled.Value) then
BarInfo.Text = string.upper(tostring(teled.Value)).. "'S CHECKPOINT"
SelectionSurface.Color = BrickColor.Red()
elseif claim and claim.Value ~= Player.Name and Players:FindFirstChild(claim.Value) then
BarInfo.Text = string.upper(tostring(claim.Value)).. " CLAIMED THIS"
SelectionSurface.Color = BrickColor.Red()
else BarInfo.Text = string.upper(target.Name) BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,35),UDim2.new(0, 0, -1, -5), "Out", "Quad", 0.075, true)
end
else wait() SelectionSurface.Adornee = nil BarInfo.Text = " " BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,0),UDim2.new(0, 0, 1, -5), "Out", "Quad", 0.3, true)
end
else wait() SelectionSurface.Adornee = nil BarInfo.Text = " " BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,0),UDim2.new(0, 0, 1, -5), "Out", "Quad", 0.3, true)
end
end
end
end

function onSelected(mouse)
checkInventory()
if not activePick then activePick = true cancel = false
cGui["ProgressFrame"]:TweenPosition(UDim2.new(0.5, -85, 1, -90), "Out", "Elastic", 0.5, true)
BarInfo.Text = " " BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,0),UDim2.new(0, 0, 1, -5), "Out", "Quad", 0.3, true)
mouse.Icon = "http://www.roblox.com/asset/?id=81886844"
gui["Tool1"].ToolSelected.Value = true
if gui["Tools"].Value == 1 then
gui["Tool1"]:TweenSizeAndPosition(UDim2.new(0,70,0,70),UDim2.new(0.5, -65, 1, -75), "Out", "Quad", 0.075,true)
elseif gui["Tools"].Value == 3 then
gui["Tool1"]:TweenSizeAndPosition(UDim2.new(0,70,0,70),UDim2.new(0.5, -125, 1, -75), "Out", "Quad", 0.075,true)
end
plrSpeed = Workspace.Generation.Speed:InvokeServer()
Workspace.Generation.ToolEffect:InvokeServer()
mouse.Move:connect(function() onMouseMoved(mouse) end)
mouse.Button1Down:connect(function() onMouseButton1Down(mouse) end)
end
end

function onDeselected(mouse)
if activePick then activePick = false
cGui["ProgressFrame"]:TweenPosition(UDim2.new(0.5, -85, 1, 100), "Out", "Quad", 0.5, true)
BarInfo.Text = " " BarInfo.Parent:TweenSizeAndPosition(UDim2.new(1,0,0,0),UDim2.new(0, 0, 1, -5), "Out", "Quad", 0.3, true)
gui["Tool1"].ToolSelected.Value = false
if gui["Tools"].Value == 1 then
gui["Tool1"]:TweenSizeAndPosition(UDim2.new(0,60,0,60),UDim2.new(0.5, -60, 1, -70), "Out", "Quad", 0.075,true)
elseif gui["Tools"].Value == 3 then
gui["Tool1"]:TweenSizeAndPosition(UDim2.new(0,60,0,60),UDim2.new(0.5, -120, 1, -70), "Out", "Quad", 0.075,true)
end
cancel = true
SelectionSurface.Adornee = nil
end
end

Tool.Equipped:connect(onSelected)
Tool.Unequipped:connect(onDeselected)
Report Abuse
NormaINorm is not online. NormaINorm
Joined: 11 Dec 2012
Total Posts: 315
14 Dec 2015 02:32 AM
1.) Why do you have so much space in your variables?
2.) I don't think anyone can be bothered reading and understanding this whole thing, there are some good lads who do though.
Report Abuse
T00NAMI is not online. T00NAMI
Joined: 10 Mar 2013
Total Posts: 211
14 Dec 2015 06:08 AM
This is pretty much the Pickaxe LocalScript that Dummiez uses in The Quarry (or the one he used to use when the quarry got leaked, his updated version could very well use something different by now.)

As someone who is on his staff team, I should tell you that having a copy of his game is not permitted. We have been getting after people who are profiting off a modified copy of The Quarry for months now, but with little success unfortunately.

However, since the copy is leaked and hundreds of people have it now, and the fact he has once said that people can upload a modified version as long as they don't profit from it (by having no game passes at all) I guess it would be fine to ask for script help on it.

We all know the scripts are a mess, its been written in such a sloppy way on purpose I suppose. I mean, if I had a game stolen, I too would make it very hard to follow, or even go so far as to encrypt all the variables and make it as confusing as possible, to give leakers a hard time modifying the game.

Just know that Dummiez did not intend for The Quarry to get leaked, im not 100% sure how it happened but the entire staff team have been banning players from group and game who have a copy place active and especially if selling game passes on them.

I just wanted to get this out there so you all know about this, in case you didn't.
Report Abuse
Lo202 is not online. Lo202
Joined: 31 Jan 2013
Total Posts: 579
14 Dec 2015 06:29 AM
@T00NAMI

I have modified quite a number of stuff in my version of quarry
-Made ore spawn easier
-Changed the price of ores
-Speed of pickaxe
-Size of dynamites

I really hope mine doesnt get deleted or something.


REFER ME: http://www.roblox.com/Hanukkah-Beanie-item?id=327317662&rbxp=37649366
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image