Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- debounce = false
- local vPlayer = game.Players.LocalPlayer
- local SBox = Instance.new("SelectionBox")
- local Tool = script.Parent;
- local Select
- local Orig
- local Dragger
- function onButton1Down(mouse)
- local Target = mouse.Target
- local Sound = Instance.new("Sound")-- The "ding" sound
- Sound.SoundId = "rbxasset://sounds\\electronicpingshort.wav"
- Sound.Name = "PewPew"
- Sound.Parent = Tool
- if Target and Target:IsA("BasePart") and not Target.Locked then
- if debounce == false then
- debounce = true
- Orig = Target
- Select = Orig:clone()
- Select.Parent = game.Workspace
- Select.Position = Orig.Position + Vector3.new(0, 0.4, 0)
- Dragger = Instance.new("Dragger")
- pcall(function() Dragger:MouseDown(Select, Vector3.new(0, 0, 0), {Select}) end)
- SBox.Adornee = Select
- Sound:Play()
- wait(0)-- Edit this to how long you would like to wait until the next copy
- mouse.Icon = "rbxasset://textures\\DragCursor.png"
- debounce = false
- end
- end
- end
- function onButton1Up(mouse)
- if Dragger then
- Orig = nil
- pcall(function() Dragger:MouseUp() end)
- Select = nil
- SBox.Adornee = nil
- Dragger = nil
- mouse.Icon = "rbxasset://textures\\CloneOverCursor.png"
- end
- end
- function onMouseMove(mouse)
- if Dragger then
- mouse.Icon = "rbxasset://textures\\GrabRotateCursor.png"
- pcall(function() Dragger:MouseMove(mouse.UnitRay) end)
- else
- local Target = mouse.Target
- if Target and Target:IsA("BasePart") and not Target.Locked then
- mouse.Icon = "rbxasset://textures\\CloneOverCursor.png"
- else
- mouse.Icon = "rbxasset://textures\\CloneCursor.png"
- end
- end
- end
- function onKeyDown(key)
- if Dragger then
- key = key:lower()
- if key == 'r' then
- Dragger:AxisRotate(Enum.Axis.Y)
- elseif key == 't' then
- Dragger:AxisRotate(Enum.Axis.Z)
- end
- end
- end
- function onEquippedLocal(mouse)
- SBox.Color = BrickColor.new("Cyan")
- SBox.Parent = vPlayer.PlayerGui
- mouse.Button1Down:Connect(function() onButton1Down(mouse) end)
- mouse.Button1Up:Connect(function() onButton1Up(mouse) end)
- mouse.Move:Connect(function() onMouseMove(mouse) end)
- mouse.KeyDown:Connect(onKeyDown)
- end
- function onUnequippedLocal(mouse)
- if Tool:findFirstChild("PewPew") then
- Tool.PewPew:remove()
- end
- if Dragger then
- Orig = nil
- pcall(function() Dragger:MouseUp() end)
- Select = nil
- SBox.Adornee = nil
- Dragger = nil
- end
- end
- Tool.Equipped:Connect(onEquippedLocal)
- Tool.Unequipped:Connect(onUnequippedLocal)
Advertisement
Add Comment
Please, Sign In to add comment