Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if owner.Backpack:FindFirstChild("Phone") then
- owner.Backpack:FindFirstChild("Phone"):Destroy()
- end
- if owner.Backpack:FindFirstChild("Ender Pearl") then
- owner.Backpack:FindFirstChild("Ender Pearl"):Destroy()
- end
- spawn(function()
- local Tool0 = Instance.new("Tool")
- local Part1 = Instance.new("Part")
- local ParticleEmitter2 = Instance.new("ParticleEmitter")
- local BillboardGui3 = Instance.new("BillboardGui")
- local ImageLabel4 = Instance.new("ImageLabel")
- local LocalScript5 = Instance.new("LocalScript")
- Tool0.Name = "Ender Pearl"
- Tool0.Parent = owner.Backpack
- Tool0.Grip = CFrame.new(0.200000003, 0, 0.100000001, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Tool0.GripPos = Vector3.new(0.200000003, 0, 0.100000001)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.CFrame = CFrame.new(46.7503319, 4.53458595, 45.4952736, -0.136415645, -0.0254911631, -0.990323722, -0.0140755745, 0.999617755, -0.0237914771, 0.99055177, 0.0106938463, -0.136722296)
- Part1.Orientation = Vector3.new(1.36000001, -97.8600006, -0.810000002)
- Part1.Position = Vector3.new(46.7503319, 4.53458595, 45.4952736)
- Part1.Rotation = Vector3.new(170.130005, -82.0199966, 169.419998)
- Part1.Color = Color3.new(0.0627451, 0.164706, 0.862745)
- Part1.Transparency = 1
- Part1.Size = Vector3.new(0.699999988, 0.699999988, 0.699999988)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Lapis")
- Part1.CanCollide = false
- Part1.Material = Enum.Material.Neon
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Lapis")
- Part1.Shape = Enum.PartType.Ball
- ParticleEmitter2.Parent = Part1
- ParticleEmitter2.Speed = NumberRange.new(0.60000002384186, 0.60000002384186)
- ParticleEmitter2.Color = ColorSequence.new(Color3.new(0.333333, 0, 0.498039),Color3.new(0.666667, 0, 1))
- ParticleEmitter2.LightInfluence = 1
- ParticleEmitter2.Transparency = NumberSequence.new(0,0,1)
- ParticleEmitter2.Size = NumberSequence.new(0.10000000149012,0.10000000149012)
- ParticleEmitter2.Lifetime = NumberRange.new(0.5, 0.5)
- ParticleEmitter2.Rate = 10
- BillboardGui3.Name = "image"
- BillboardGui3.Parent = Part1
- BillboardGui3.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel4.Parent = BillboardGui3
- ImageLabel4.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel4.BackgroundColor = BrickColor.new("Institutional white")
- ImageLabel4.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel4.BackgroundTransparency = 1
- ImageLabel4.SizeConstraint = Enum.SizeConstraint.RelativeXX
- ImageLabel4.Image = "rbxassetid://140576058"
- LocalScript5.Parent = Tool0
- ----------------------------------------------
- ----------------------------------------------
- ----------------------------------------------
- local player = owner
- repeat wait() until player.Character
- local character = player.Character
- local handle = Part1
- local tool = Tool0
- local mouse = player:GetMouse()
- local power = 300
- local equipped = false
- tool.Equipped:connect(function()
- equipped = true
- end)
- tool.Unequipped:connect(function()
- equipped = false
- end)
- local remote = Instance.new("RemoteEvent",Tool0)
- remote.Name = "remote pearl"
- local code = [[
- remote = script.Parent:WaitForChild("remote pearl")
- mouse = game.Players.LocalPlayer:GetMouse()
- mouse.Button1Down:Connect(function()
- local pos = mouse.Hit.p
- remote:FireServer(pos,1)
- end)
- mouse.KeyDown:Connect(function(key)
- local pos = mouse.Hit.p
- remote:FireServer(key,2,pos)
- end)
- ]]
- NLS(code,Tool0)
- local oldmousepos = nil
- local mousepos = nil
- remote.OnServerEvent:Connect(function(plr,pos,mode)
- if mode == 1 then
- oldmousepos = mousepos
- mousepos = pos
- end
- end)
- remote.OnServerEvent:Connect(function(plr,key,mode,pos)
- spawn(function()
- if mode == 2 and key == "e" and equipped == true then
- oldmousepos = mousepos
- mousepos = pos
- local pag = Instance.new("Part")
- pag.Parent = game.Workspace
- pag.CanCollide = false
- pag.Transparency = 1
- pag.Anchored = true
- pag.CanCollide = false
- repeat wait() until oldmousepos ~= mousepos
- pag.CFrame = CFrame.new(handle.Position,mousepos)
- local pearl = handle:Clone()
- pearl.Parent = game.Workspace
- pearl.Name = "EnderPearl"
- pearl.CanCollide = false
- pearl.Velocity = pag.CFrame.lookVector * power
- pearl.Touched:connect(function(part)
- if part ~= nil then
- if part.Parent ~= nil then
- if part.Parent ~= character and part.Name ~= "Handle" and part.Name ~= "EnderPearl" and part.Name ~= "Ender Sphere" then
- local ex = Instance.new("Explosion",workspace)
- ex.BlastPressure = 1
- ex.BlastRadius = 12
- ex.ExplosionType = Enum.ExplosionType.CratersAndDebris
- ex.Visible = false
- ex.Hit:Connect(function(obj)
- obj:BreakJoints()
- end)
- local sphere = Instance.new("Part",workspace)
- sphere.Name = "Ender Sphere"
- sphere.Shape = Enum.PartType.Ball
- sphere.BrickColor = BrickColor.new("Really black")
- sphere.Size = Vector3.new(2,2,2)
- sphere.Material = Enum.Material.Neon
- sphere.Anchored = true
- sphere.CanCollide = false
- sphere.Position = pearl.Position
- ex.Position = pearl.Position
- spawn(function()
- for i = 0,9,1 do
- wait()
- sphere.Size = sphere.Size+Vector3.new(3,3,3)
- sphere.Transparency = sphere.Transparency+.1
- end
- sphere:Destroy()
- end)
- local boom = Instance.new("Sound",Part1)
- boom.Volume = 2
- boom.EmitterSize = 3
- boom.MinDistance = 3
- boom.SoundId = "rbxassetid://3154829820"
- boom.Looped = false
- boom:Play()
- pearl:Destroy()
- end
- end
- end
- end)
- pag:Destroy()
- end
- end)
- spawn(function()
- if mode == 2 and key == "f" and equipped == true then
- oldmousepos = mousepos
- mousepos = pos
- local pag = Instance.new("Part")
- pag.Parent = game.Workspace
- pag.CanCollide = false
- pag.Transparency = 1
- pag.Anchored = true
- pag.CanCollide = false
- repeat wait() until oldmousepos ~= mousepos
- pag.CFrame = CFrame.new(handle.Position,mousepos)
- local pearl = handle:Clone()
- pearl.Parent = game.Workspace
- pearl.Name = "EnderPearl"
- pearl.CanCollide = false
- pearl.Velocity = pag.CFrame.lookVector * power
- pearl.Touched:connect(function(part)
- if part ~= nil then
- if part.Parent ~= nil then
- if part.Parent ~= character and part.Name ~= "Handle" and part.Name ~= "EnderPearl" and part.Name ~= "Ender Sphere" then
- local sphere = Instance.new("Part",workspace)
- sphere.Name = "Ender Sphere"
- sphere.Shape = Enum.PartType.Ball
- sphere.BrickColor = BrickColor.new("Bright green")
- sphere.Size = Vector3.new(3,3,3)
- sphere.Material = Enum.Material.ForceField
- sphere.Anchored = true
- sphere.CanCollide = false
- sphere.Position = pearl.Position
- sphere.Transparency = 1
- spawn(function()
- for i = 0,9,1 do
- wait()
- sphere.Size = sphere.Size+Vector3.new(3,3,3)
- sphere.Transparency = sphere.Transparency-.1
- end
- end)
- local ff = Instance.new("Sound",Part1)
- ff.Volume = 3
- ff.EmitterSize = 6
- ff.MinDistance = 6
- ff.SoundId = "rbxassetid://306606354"
- ff.Looped = true
- ff:Play()
- sphere.Touched:Connect(function(obj)
- if obj.Name == "Base" or obj.Name == "Baseplate" then return end
- local hum = obj.Parent:FindFirstChildOfClass("Humanoid")
- if hum ~= nil and not hum:FindFirstChild("health wait") then
- spawn(function()
- local val = Instance.new("NumberValue",hum)
- val.Name = "health wait"
- hum.Health = hum.Health + 30
- wait(.5)
- val:Destroy()
- end)
- end
- end)
- spawn(function()
- wait(math.random(5,10))
- for i = 0,9,1 do
- wait()
- ff.Volume = ff.Volume-.3
- sphere.Size = sphere.Size-Vector3.new(2,2,2)
- sphere.Transparency = sphere.Transparency+.1
- end
- ff:Destroy()
- sphere:Destroy()
- end)
- local boom = Instance.new("Sound",Part1)
- boom.Volume = 2
- boom.EmitterSize = 2
- boom.MinDistance = 2
- boom.SoundId = "rbxassetid://3154829820"
- boom.Looped = false
- boom:Play()
- pearl:Destroy()
- end
- end
- end
- end)
- pag:Destroy()
- end
- end)
- end)
- tool.Activated:connect(function()
- if equipped == true then
- local pag = Instance.new("Part")
- pag.Parent = game.Workspace
- pag.CanCollide = false
- pag.Transparency = 1
- pag.Anchored = true
- pag.CanCollide = false
- repeat wait() until oldmousepos ~= mousepos
- pag.CFrame = CFrame.new(handle.Position,mousepos)
- local pearl = handle:Clone()
- pearl.Parent = game.Workspace
- pearl.Name = "EnderPearl"
- pearl.CanCollide = false
- pearl.Velocity = pag.CFrame.lookVector * power
- pearl.Touched:connect(function(part)
- if part ~= nil then
- if part.Parent ~= nil then
- if part.Parent ~= character and part.Name ~= "Handle" and part.Name ~= "EnderPearl" and part.Name ~= "Ender Sphere" then
- character.PrimaryPart.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(5,7.5)
- local hurt = Instance.new("Sound",character.PrimaryPart)
- hurt.Volume = 1.5
- hurt.EmitterSize = 2
- hurt.MinDistance = 2
- hurt.SoundId = "rbxassetid://535690488"
- hurt.Looped = false
- hurt:Play()
- local sphere = Instance.new("Part",workspace)
- sphere.Name = "Ender Sphere"
- sphere.Shape = Enum.PartType.Ball
- sphere.BrickColor = BrickColor.new("Dark indigo")
- sphere.Size = Vector3.new(2,2,2)
- sphere.Material = Enum.Material.ForceField
- sphere.Anchored = true
- sphere.CanCollide = false
- sphere.Position = pearl.Position
- spawn(function()
- for i = 0,9,1 do
- wait()
- sphere.Size = sphere.Size+Vector3.new(3,3,3)
- sphere.Transparency = sphere.Transparency+.1
- end
- sphere:Destroy()
- end)
- local warp = Instance.new("Sound",handle)
- warp.SoundId = "rbxassetid://289556450"
- warp.Volume = 4
- warp.EmitterSize = 4
- warp:Play()
- local rotation = character.PrimaryPart.CFrame - character.PrimaryPart.Position
- character.PrimaryPart.CFrame = rotation + pearl.Position + Vector3.new(0,4,0)
- pearl:Destroy()
- end
- end
- end
- end)
- pag:Destroy()
- end
- end)
- end)
- spawn(function()
- local Tool0 = Instance.new("Tool")
- local Part1 = Instance.new("Part")
- local Part2 = Instance.new("Part")
- local Sound3 = Instance.new("Sound")
- local Sound4 = Instance.new("Sound")
- local Sound5 = Instance.new("Sound")
- local Sound6 = Instance.new("Sound")
- local Part6 = Instance.new("Part")
- local Part7 = Instance.new("Part")
- local SpotLight0 = Instance.new("SpotLight")
- Tool0.Name = "Phone"
- Tool0.Parent = owner.Backpack
- Tool0.CanBeDropped = true
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.CFrame = CFrame.new(1.70019865, 1.50620151, 14.9028263, 0, 1, 0, 0, 0, 1, 1, 0, 0)
- Part1.Orientation = Vector3.new(-90, -90, 0)
- Part1.Position = Vector3.new(1.70019865, 1.50620151, 14.9028263)
- Part1.Rotation = Vector3.new(-90, 0, -90)
- Part1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part1.Transparency = 1
- Part1.Size = Vector3.new(0.0500000007, 0.0500000007, 0.100000001)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.BrickColor = BrickColor.new("Really black")
- Part1.CanCollide = false
- Part1.Material = Enum.Material.SmoothPlastic
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.brickColor = BrickColor.new("Really black")
- Part2.Name = "Main"
- Part2.Parent = Tool0
- Part2.CFrame = CFrame.new(2.58999991, 1.76573157, 14.7767668, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part2.Position = Vector3.new(2.58999991, 1.76573157, 14.7767668)
- Part2.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part2.Size = Vector3.new(1.36016214, 0.0919028297, 0.698461592)
- Part2.BottomSurface = Enum.SurfaceType.Smooth
- Part2.BrickColor = BrickColor.new("Really black")
- Part2.CanCollide = false
- Part2.Material = Enum.Material.SmoothPlastic
- Part2.TopSurface = Enum.SurfaceType.Smooth
- Part2.brickColor = BrickColor.new("Really black")
- Sound3.Name = "call"
- Sound3.Parent = Part2
- Sound3.EmitterSize = 1
- Sound3.MinDistance = 1
- Sound3.SoundId = "rbxassetid://1500107704"
- Sound3.Volume = 1
- Sound4.Name = "ring"
- Sound4.Parent = Part2
- Sound4.EmitterSize = 1
- Sound4.MinDistance = 2
- Sound4.SoundId = "rbxassetid://152841131"
- Sound4.Volume = 1
- Sound5.Name = "click"
- Sound5.Parent = Part2
- Sound5.EmitterSize = 1
- Sound5.MinDistance = 1
- Sound5.SoundId = "rbxassetid://537744814"
- Sound5.Volume = 1
- Sound6.Name = "selfdestruct"
- Sound6.Parent = Part2
- Sound6.EmitterSize = 2
- Sound6.MinDistance = 2
- Sound6.SoundId = "rbxassetid://863434024"
- Sound6.Volume = 2
- Part6.Parent = Tool0
- Part6.CFrame = CFrame.new(2.64514279, 1.7773366, 14.7765141, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part6.Position = Vector3.new(2.64514279, 1.7773366, 14.7765141)
- Part6.Color = Color3.new(0.0705882, 0.933333, 0.831373)
- Part6.Size = Vector3.new(1.15062356, 0.079649128, 0.612685621)
- Part6.BottomSurface = Enum.SurfaceType.Smooth
- Part6.BrickColor = BrickColor.new("Teal")
- Part6.CanCollide = false
- Part6.Material = Enum.Material.Neon
- Part6.TopSurface = Enum.SurfaceType.Smooth
- Part6.brickColor = BrickColor.new("Teal")
- Part7.Parent = Tool0
- Part7.CFrame = CFrame.new(1.98568106, 1.79264569, 14.7817907, 0, -1, 0, 1, 0, 0, 0, 0, 1)
- Part7.Orientation = Vector3.new(0, 0, 90)
- Part7.Position = Vector3.new(1.98568106, 1.79264569, 14.7817907)
- Part7.Rotation = Vector3.new(0, 0, 90)
- Part7.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part7.Size = Vector3.new(0.0500000007, 0.100000001, 0.100000001)
- Part7.BottomSurface = Enum.SurfaceType.Smooth
- Part7.BrickColor = BrickColor.new("Institutional white")
- Part7.CanCollide = false
- Part7.Material = Enum.Material.SmoothPlastic
- Part7.TopSurface = Enum.SurfaceType.Smooth
- Part7.brickColor = BrickColor.new("Institutional white")
- Part7.Shape = Enum.PartType.Cylinder
- SpotLight0.Parent = Part1
- SpotLight0.Face = Enum.NormalId.Front
- SpotLight0.Range = 12
- SpotLight0.Brightness = 8
- SpotLight0.Shadows = true
- SpotLight0.Enabled = false
- function tap()
- Sound5:Play()
- SpotLight0.Enabled = not SpotLight0.Enabled
- end
- local destruct = false
- local calling = false
- local remote = Instance.new("RemoteEvent",Tool0)
- local code = [[
- wait(.2)
- mouse = game:GetService("Players").LocalPlayer:GetMouse()
- remote = script.Parent
- mouse.KeyDown:Connect(function(k)
- remote:FireServer(k)
- end)
- ]]
- local lastchar = owner.Character
- local equipped = false
- NLS(code,remote)
- Tool0.Unequipped:Connect(function()
- equipped = false
- end)
- remote.OnServerEvent:Connect(function(plr,key)
- Tool0.Equipped:Connect(function()
- equipped = true
- if key == "e" and destruct == false and equipped == true then
- destruct = true
- Sound3:Stop()
- local warning = Instance.new("Sound",Part2)
- warning.Volume = 2
- warning.EmitterSize = 3
- warning.MinDistance = 2
- warning.SoundId = "rbxassetid://867511220"
- warning.Looped = false
- warning.TimePosition = .5
- warning:Play()
- repeat wait() until warning.TimePosition > 3
- Sound6:Play()
- Sound6.TimePosition = 110
- calling = false
- Part6.BrickColor = BrickColor.new("Really red")
- spawn(function()
- while true do
- wait()
- if Tool0 and game:GetService("Players"):GetPlayerFromCharacter(Tool0.Parent) then
- lastchar = Tool0.Parent
- else
- Tool0.Parent = lastchar
- end
- if lastchar:FindFirstChildOfClass("ForceField") then
- lastchar:FindFirstChildOfClass("ForceField"):Destroy()
- end
- end
- end)
- spawn(function()
- repeat wait() until Sound6.TimePosition > 124
- local ex = Instance.new("Explosion",workspace)
- ex.BlastPressure = 1
- ex.BlastRadius = 20
- ex.ExplosionType = Enum.ExplosionType.CratersAndDebris
- --ex.Position = Part1.Position
- ex.Visible = false
- local sphere = Instance.new("Part",workspace)
- sphere.Shape = Enum.PartType.Ball
- sphere.BrickColor = BrickColor.new("Really red")
- sphere.Size = Vector3.new(2,2,2)
- sphere.Material = Enum.Material.Neon
- sphere.Anchored = true
- sphere.CanCollide = false
- sphere.Position = lastchar:FindFirstChild("HumanoidRootPart").Position
- ex.Position = lastchar:FindFirstChild("HumanoidRootPart").Position
- spawn(function()
- for i = 0,9,1 do
- wait()
- sphere.Size = sphere.Size+Vector3.new(3,3,3)
- sphere.Transparency = sphere.Transparency+.1
- end
- sphere:Destroy()
- end)
- local boom = Instance.new("Sound",Part1)
- boom.Volume = 2
- boom.EmitterSize = 2
- boom.MinDistance = 2
- boom.SoundId = "rbxassetid://3154829820"
- boom.Looped = false
- boom:Play()
- end)
- end
- if key == "r" and destruct == false and calling == false then
- calling = true
- Sound3:Play()
- spawn(function()
- repeat wait() until (Sound3.TimePosition > 20 or calling == false)
- calling = false
- wait(math.random(10,15))
- Sound3:Stop()
- if calling == false and destruct == false then
- for i = 0,4,1 do
- Sound4:Play()
- wait(2.6379)
- end
- end
- end)
- end
- --[[if key == "f" then
- for i,v in pairs(game:GetService("Players"):GetChildren()) do
- if mouse.Target.Parent.Name == v.Name then
- Tool0.Parent = v.Backpack
- end
- end
- end]]
- end)
- end)
- Tool0.Activated:Connect(function()
- tap()
- end)
- function GetPlr(plr, str)
- local plrz = {} str = str:lower()
- if str == "all" then plrz = game:GetService("Players"):children()
- elseif str == "others" then for i, v in pairs(game:GetService("Players"):children()) do if v ~= plr then table.insert(plrz, v) end end
- else
- local sn = {1} local en = {}
- for i = 1, #str do if str:sub(i,i) == "," then table.insert(sn, i+1) table.insert(en,i-1) end end
- for x = 1, #sn do
- if (sn[x] and en[x] and str:sub(sn[x],en[x]) == "me") or (sn[x] and str:sub(sn[x]) == "me") then table.insert(plrz, plr)
- if game:findFirstChild("Teams") then for a, v in pairs(game.Teams:children()) do if v:IsA("Team") and str:sub(sn[x],en[x]):sub(6) ~= "" and v.Name:lower():find(str:sub(sn[x],en[x]):sub(6)) == 1 then
- for q, p in pairs(game:GetService("Players"):children()) do if p.TeamColor == v.TeamColor then table.insert(plrz, p) end end break
- end end end
- elseif (sn[x] and str:sub(sn[x]):sub(1,4):lower() == "team") then
- if game:findFirstChild("Teams") then for a, v in pairs(game.Teams:children()) do if v:IsA("Team") and str:sub(sn[x],en[x]):sub(6) ~= "" and v.Name:lower():find(str:sub(sn[x]):sub(6)) == 1 then
- for q, p in pairs(game:GetService("Players"):children()) do if p.TeamColor == v.TeamColor then table.insert(plrz, p) end end break
- end end end
- else
- for a, plyr in pairs(game:GetService("Players"):children()) do
- if (sn[x] and en[x] and str:sub(sn[x],en[x]) ~= "" and plyr.Name:lower():find(str:sub(sn[x],en[x])) == 1) or (sn[x] and str:sub(sn[x]) ~= "" and plyr.Name:lower():find(str:sub(sn[x])) == 1) or (str ~= "" and plyr.Name:lower():find(str) == 1) then
- table.insert(plrz, plyr) break
- end
- end
- end
- end
- end
- return plrz
- end
- owner.Chatted:Connect(function(msg)
- if msg:sub(1,5) == "give/" then
- local plrz = GetPlr(owner, msg:lower():sub(6))
- for i, v in pairs(plrz) do
- coroutine.resume(coroutine.create(function()
- if v and v.Character then
- lastchar = v.Character
- Tool0.Parent = v.Backpack
- end
- end))
- end
- end
- end)
- spawn(function()
- local NEVER_BREAK_JOINTS = false
- local function CallOnChildren(Instance, FunctionToCall)
- FunctionToCall(Instance)
- for _, Child in next, Instance:GetChildren() do
- CallOnChildren(Child, FunctionToCall)
- end
- end
- local function GetNearestParent(Instance, ClassName)
- local Ancestor = Instance
- repeat
- Ancestor = Ancestor.Parent
- if Ancestor == nil then
- return nil
- end
- until Ancestor:IsA(ClassName)
- return Ancestor
- end
- local function GetBricks(StartInstance)
- local List = {}
- CallOnChildren(StartInstance, function(Item)
- if Item:IsA("BasePart") then
- List[#List+1] = Item;
- end
- end)
- return List
- end
- local function Modify(Instance, Values)
- assert(type(Values) == "table", "Values is not a table");
- for Index, Value in next, Values do
- if type(Index) == "number" then
- Value.Parent = Instance
- else
- Instance[Index] = Value
- end
- end
- return Instance
- end
- local function Make(ClassType, Properties)
- return Modify(Instance.new(ClassType), Properties)
- end
- local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
- local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
- local function HasWheelJoint(Part)
- for _, SurfaceName in pairs(Surfaces) do
- for _, HingSurfaceName in pairs(HingSurfaces) do
- if Part[SurfaceName].Name == HingSurfaceName then
- return true
- end
- end
- end
- return false
- end
- local function ShouldBreakJoints(Part)
- if NEVER_BREAK_JOINTS then
- return false
- end
- if HasWheelJoint(Part) then
- return false
- end
- local Connected = Part:GetConnectedParts()
- if #Connected == 1 then
- return false
- end
- for _, Item in pairs(Connected) do
- if HasWheelJoint(Item) then
- return false
- elseif not Item:IsDescendantOf(script.Parent) then
- return false
- end
- end
- return true
- end
- local function WeldTogether(Part0, Part1, JointType, WeldParent)
- JointType = JointType or "Weld"
- local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
- local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
- Modify(NewWeld, {
- Name = "qCFrameWeldThingy";
- Part0 = Part0;
- Part1 = Part1;
- C0 = CFrame.new();--Part0.CFrame:inverse();
- C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
- Parent = Part1;
- })
- if not RelativeValue then
- RelativeValue = Make("CFrameValue", {
- Parent = Part1;
- Name = "qRelativeCFrameWeldValue";
- Archivable = true;
- Value = NewWeld.C1;
- })
- end
- return NewWeld
- end
- local function WeldParts(Parts, MainPart, JointType)
- for _, Part in pairs(Parts) do
- if ShouldBreakJoints(Part) then
- Part:BreakJoints()
- end
- end
- for _, Part in pairs(Parts) do
- if Part ~= MainPart then
- WeldTogether(MainPart, Part, JointType, MainPart)
- end
- end
- end
- local function PerfectionWeld()
- local Tool = GetNearestParent(script, "Tool")
- local Parts = GetBricks(Tool0)
- local PrimaryPart = Part1
- if PrimaryPart then
- WeldParts(Parts, PrimaryPart, "Weld")
- else
- warn("qWeld - Unable to weld part")
- end
- return Tool
- end
- local Tool = PerfectionWeld()
- if Tool and script.ClassName == "Script" then
- script.Parent.AncestryChanged:connect(function()
- PerfectionWeld()
- end)
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement