Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = owner
- local char = plr.Character
- local hum = char:FindFirstChildOfClass("Humanoid")
- local torso = char:FindFirstChild('Torso') or char:FindFirstChild('UpperTorso')
- debris = game:GetService("Debris")
- tween = game:GetService("TweenService")
- local equipped = false
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- Tool0.Name = "Detector"
- Tool0.Parent = plr['Backpack']
- Tool0.Grip = CFrame.new(0.138040528, 0, 0.138869286, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Tool0.GripPos = Vector3.new(0.138040528, 0, 0.138869286)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.CFrame = CFrame.new(-12.3699999, 0.500003994, 10.9099998, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Position = Vector3.new(-12.3699999, 0.500003994, 10.9099998)
- Part1.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part1.Size = Vector3.new(1, 1, 1)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Institutional white")
- Part1.Material = Enum.Material.Neon
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Institutional white")
- function FindPrimaryParts()
- local List = {}
- for i, v in pairs(workspace:GetDescendants()) do
- if v:IsA("Model") then
- if v.PrimaryPart or v:FindFirstChild("HumanoidRootPart") or v:FindFirstChildOfClass("Humanoid") or v:FindFirstChild("Head") then
- if v ~= char then
- table.insert(List, v)
- end
- end
- end
- end
- return List
- end
- function FindTouched()
- local List = {}
- for i, v in pairs(workspace:GetDescendants()) do
- if v:FindFirstChildOfClass("TouchTransmitter") then
- if v ~= char then
- table.insert(List, v)
- end
- end
- end
- return List
- end
- local handle = Part1
- local tool = Tool0
- local beep = Instance.new("Sound",handle)
- beep.SoundId = "rbxassetid://3378132335"
- beep.Volume = 0.5
- local target = nil
- local targetbox = nil
- local hitboxes = {}
- tool.Equipped:Connect(function()
- equipped = true
- end)
- tool.Unequipped:Connect(function()
- equipped = false
- beep:Stop()
- if targetbox then
- targetbox:Destroy()
- end
- target = nil
- end)
- local remote = Instance.new("RemoteEvent",char)
- remote.Name = "wandremote"
- local code = [[
- local mouse = game:GetService("Players").LocalPlayer:GetMouse()
- local remote = script.Parent
- mouse.Button1Down:Connect(function()
- remote:FireServer(1,mouse.Target)
- end)
- mouse.KeyDown:Connect(function(key)
- if key == "x" then
- remote:FireServer(2,"destroy")
- end
- end)
- ]]
- NLS(code,remote)
- remote.OnServerEvent:Connect(function(plr,mode,data,data2)
- if mode == 1 and equipped then
- if data and data.Parent and data.Name ~= ("Base" and "Baseplate") --[[and (data.Parent:FindFirstChild("KrY's Detector " .. name + name2) or data:FindFirstChild("KrY's Detector " .. name + name2))]] then
- if targetbox then
- targetbox:Destroy()
- end
- target = data
- targetbox = Instance.new("SelectionBox",target)
- targetbox.SurfaceTransparency = 1
- targetbox.LineThickness = .1
- targetbox.Adornee = target
- targetbox.Color3 = Color3.new(58/255, 125/255, 21/255)
- end
- end
- if mode == 2 and equipped then
- if data == "destroy" and target and target.Parent then
- target:Destroy()
- target = nil
- targetbox = nil
- end
- end
- end)
- spawn(function()
- while tool do
- wait()
- if equipped then else continue end
- beep:Play()
- handle.BrickColor = BrickColor.Random()
- local touch = FindTouched()
- local primaryparts = FindPrimaryParts()
- for _,t in ipairs(touch) do
- local hb = t:FindFirstChild("Selection boi " .. plr.Name)
- if not t:FindFirstChild("KrY's Detector " .. plr.Name) then
- local confirm = Instance.new("IntValue",t)
- confirm.Name = ("KrY's Detector " .. plr.Name)
- hb = Instance.new("SelectionBox",t)
- hb.Name = ("Selection boi " .. plr.Name)
- hb.SurfaceTransparency = 1
- hb.LineThickness = .1
- hb.Adornee = t
- hb.Color3 = Color3.new(175/255, 221/255, 255/255)
- hitboxes[hb] = hb
- end
- if not hitboxes[t] then
- hitboxes[t] = hb
- end
- end
- for _,p in ipairs(primaryparts) do
- local hb = p:FindFirstChild("Selection boi " .. plr.Name)
- if not p:FindFirstChild("KrY's Detector " .. plr.Name) then
- local confirm = Instance.new("IntValue",p)
- confirm.Name = ("KrY's Detector " .. plr.Name)
- hb = Instance.new("SelectionBox",p)
- hb.Name = ("Selection boi " .. plr.Name)
- hb.SurfaceTransparency = 1
- hb.LineThickness = .1
- hb.Adornee = p
- hb.Color3 = Color3.new(175/255, 221/255, 255/255)
- hitboxes[hb] = hb
- end
- if not hitboxes[p] then
- hitboxes[p] = hb
- end
- end
- for i,v in pairs(hitboxes) do
- if v then else continue end
- local vis = true
- v.Visible = vis
- if target then
- targetbox.Visible = vis
- end
- end
- wait(0.25)
- for i,v in pairs(hitboxes) do
- if v then else continue end
- local vis = false
- v.Visible = vis
- if target then
- targetbox.Visible = vis
- end
- end
- wait(0.25)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement