Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- Sound2 = Instance.new("Sound")
- Sound3 = Instance.new("Sound")
- SpecialMesh4 = Instance.new("SpecialMesh")
- Script5 = Instance.new("Script")
- Script6 = Instance.new("Script")
- Script7 = Instance.new("Script")
- Script8 = Instance.new("Script")
- Script9 = Instance.new("Script")
- Script10 = Instance.new("Script")
- Script11 = Instance.new("Script")
- Motor6D12 = Instance.new("Motor6D")
- Motor6D13 = Instance.new("Motor6D")
- Motor6D14 = Instance.new("Motor6D")
- Motor6D15 = Instance.new("Motor6D")
- Motor6D16 = Instance.new("Motor6D")
- Script17 = Instance.new("Script")
- LocalScript18 = Instance.new("LocalScript")
- LocalScript19 = Instance.new("LocalScript")
- Tool20 = Instance.new("Tool")
- Part21 = Instance.new("Part")
- CylinderMesh22 = Instance.new("CylinderMesh")
- Part23 = Instance.new("Part")
- SpecialMesh24 = Instance.new("SpecialMesh")
- LocalScript25 = Instance.new("LocalScript")
- Script26 = Instance.new("Script")
- LocalScript27 = Instance.new("LocalScript")
- Script28 = Instance.new("Script")
- LocalScript29 = Instance.new("LocalScript")
- Part30 = Instance.new("Part")
- Script31 = Instance.new("Script")
- Tool32 = Instance.new("Tool")
- LocalScript33 = Instance.new("LocalScript")
- LocalScript34 = Instance.new("LocalScript")
- Configuration35 = Instance.new("Configuration")
- NumberValue36 = Instance.new("NumberValue")
- NumberValue37 = Instance.new("NumberValue")
- BoolValue38 = Instance.new("BoolValue")
- NumberValue39 = Instance.new("NumberValue")
- NumberValue40 = Instance.new("NumberValue")
- Sound41 = Instance.new("Sound")
- LocalScript42 = Instance.new("LocalScript")
- Tool0.Name = "Lazer"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=13505853"
- Tool0.GripForward = Vector3.new(-0, 1, -0)
- Tool0.GripPos = Vector3.new(0, -0.600000024, -0.550000012)
- Tool0.GripUp = Vector3.new(0, 0, 1)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.Rotation = Vector3.new(-90, 0, 90)
- Part1.FormFactor = Enum.FormFactor.Plate
- Part1.Size = Vector3.new(1, 2, 1)
- Part1.CFrame = CFrame.new(7.80001831, 0.900000036, 6.8999939, 0, -1, 0, 0, 0, 1, -1, 0, 0)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Position = Vector3.new(7.80001831, 0.900000036, 6.8999939)
- Part1.Orientation = Vector3.new(-90, 90, 0)
- Sound2.Name = "EquipSound"
- Sound2.Parent = Part1
- Sound2.Pitch = 0.5
- Sound2.SoundId = "http://www.roblox.com/asset/?id=10756118"
- Sound3.Name = "PewPew"
- Sound3.Parent = Part1
- Sound3.Pitch = 0.5
- Sound3.SoundId = "http://www.roblox.com/asset/?id=13775480"
- Sound3.Volume = 1
- SpecialMesh4.Parent = Part1
- SpecialMesh4.MeshId = "http://www.roblox.com/asset/?id=22963494"
- SpecialMesh4.Scale = Vector3.new(1.29999995, 2, 1.29999995)
- SpecialMesh4.TextureId = "http://www.roblox.com/asset/?id=23396790"
- SpecialMesh4.MeshType = Enum.MeshType.FileMesh
- SpecialMesh4.Scale = Vector3.new(1.29999995, 2, 1.29999995)
- Script5.Name = "Script2"
- Script5.Parent = Part1
- Script5.Disabled = true
- table.insert(cors,sandbox(Script5,function()
- local h = game.StarterGui:getChildren()
- for i=1, #h do
- if h[i].Name == "Left Hip" then
- local joint = h[i]:clone()
- joint.Parent = script.Parent
- h[i].Part0 = script.Parent
- h[i].Part1 = script.Parent.Parent:findFirstChild("Left Leg")
- wait(0.1)
- script:remove()
- end
- end
- end))
- Script6.Name = "Script3"
- Script6.Parent = Part1
- Script6.Disabled = true
- table.insert(cors,sandbox(Script6,function()
- local h = game.StarterGui:getChildren()
- for i=1, #h do
- if h[i].Name == "Left Shoulder" then
- local joint = h[i]:clone()
- joint.Parent = script.Parent
- wait(1)
- h[i].Part0 = script.Parent
- h[i].Part1 = script.Parent.Parent:findFirstChild("Left Arm")
- wait(0.1)
- script:remove()
- end
- end
- end))
- Script7.Name = "Script4"
- Script7.Parent = Part1
- Script7.Disabled = true
- table.insert(cors,sandbox(Script7,function()
- local h = game.StarterGui:getChildren()
- for i=1, #h do
- if h[i].Name == "Right Hip" then
- local joint = h[i]:clone()
- joint.Parent = script.Parent
- wait(1)
- h[i].Part0 = script.Parent
- h[i].Part1 = script.Parent.Parent:findFirstChild("Right Leg")
- wait(0.1)
- script:remove()
- end
- end
- end))
- Script8.Name = "Script5"
- Script8.Parent = Part1
- Script8.Disabled = true
- table.insert(cors,sandbox(Script8,function()
- local h = game.StarterGui:getChildren()
- for i=1, #h do
- if h[i].Name == "Right Shoulder" then
- local joint = h[i]:clone()
- joint.Parent = script.Parent
- wait(1)
- h[i].Part0 = script.Parent
- h[i].Part1 = script.Parent.Parent:findFirstChild("Right Arm")
- wait(0.1)
- script:remove()
- end
- end
- end))
- Script9.Name = "Script6"
- Script9.Parent = Part1
- Script9.Disabled = true
- table.insert(cors,sandbox(Script9,function()
- local h = game.StarterGui:getChildren()
- for i=1, #h do
- if h[i].Name == "Neck" then
- local joint = h[i]:clone()
- joint.Parent = script.Parent
- wait(1)
- h[i].Part0 = script.Parent
- h[i].Part1 = script.Parent.Parent:findFirstChild("Head")
- wait(0.1)
- script:remove()
- end
- end
- end))
- Script10.Name = "LaserBlast"
- Script10.Parent = Tool0
- Script10.Disabled = true
- table.insert(cors,sandbox(Script10,function()
- ball = script.Parent
- function onTouched(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- if humanoid ~= nil then
- humanoid:TakeDamage(5)
- if hit.Parent:findFirstChild("Ragdoll") == nil then
- if hit.Parent.Torso:findFirstChild("Left Shoulder") ~= nil then
- hit.Parent.Torso:findFirstChild("Left Shoulder").Parent = nil
- end
- if hit.Parent.Torso:findFirstChild("Right Shoulder") ~= nil then
- hit.Parent.Torso:findFirstChild("Right Shoulder").Parent = nil
- end
- if hit.Parent.Torso:findFirstChild("Left Hip") ~= nil then
- hit.Parent.Torso:findFirstChild("Left Hip").Parent = nil
- end
- if hit.Parent.Torso:findFirstChild("Right Hip") ~= nil then
- hit.Parent.Torso:findFirstChild("Right Hip").Parent = nil
- end
- script.Ragdoll:Clone().Parent = humanoid.Parent
- hit.archivable = true
- hit.Locked = false
- script:remove()
- else humanoid.Parent.Ragdoll:remove()
- local h = script.Parent.Parent.Lazer.Handle:getChildren()
- for i=1, #h do
- if h[i].className == "Script" then
- local j = h[i]:clone()
- j.Parent = humanoid.Parent.Torso
- j.Disabled = false
- local k = humanoid.Parent:getChildren()
- for i=1, #k do
- if k[i].Name == "Part" then
- k[i]:remove()
- end
- end
- humanoid.PlatformStand = false
- local anim = j.Parent.Parent:findFirstChild("Animate")
- local anim2 = j.Parent.Parent:findFirstChild("Animate"):clone()
- anim2.Parent = j.Parent.Parent
- anim:remove()
- script:remove()
- end
- end
- end
- end
- end
- connection = ball.Touched:connect(onTouched)
- wait(10)
- ball.Parent = nil
- end))
- Script11.Name = "Ragdoll"
- Script11.Parent = Script10
- table.insert(cors,sandbox(Script11,function()
- Character = script.Parent
- Torso = Character.Torso
- if Character then
- if Torso then
- Humanoid = Character:findFirstChild("Humanoid")
- Zombie = Character:findFirstChild("Zombie")
- if Humanoid ~= nil then
- Humanoid.PlatformStand = true
- end
- if Zombie ~= nil then
- Zombie.PlatformStand = true
- end
- local Head = Character:FindFirstChild("Head")
- if Head then
- local Neck = Instance.new("Weld")
- Neck.Name = "Neck"
- Neck.Part0 = Torso
- Neck.Part1 = Head
- Neck.C0 = CFrame.new(0, 1.5, 0)
- Neck.C1 = CFrame.new()
- Neck.Parent = Torso
- end
- local Limb = Character:FindFirstChild("Right Arm")
- if Limb then
- Limb.CFrame = Torso.CFrame * CFrame.new(1.5, 0, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "RightShoulder"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- local Limb = Character:FindFirstChild("Left Arm")
- if Limb then
- Limb.CFrame = Torso.CFrame * CFrame.new(-1.5, 0, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "LeftShoulder"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- local Limb = Character:FindFirstChild("Right Leg")
- if Limb then
- Limb.CFrame = Torso.CFrame * CFrame.new(0.5, -2, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "RightHip"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- local Limb = Character:FindFirstChild("Left Leg")
- if Limb then
- Limb.CFrame = Torso.CFrame * CFrame.new(-0.5, -2, 0)
- local Joint = Instance.new("Glue")
- Joint.Name = "LeftHip"
- Joint.Part0 = Torso
- Joint.Part1 = Limb
- Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
- Joint.Parent = Torso
- local B = Instance.new("Part")
- B.TopSurface = 0
- B.BottomSurface = 0
- B.formFactor = "Symmetric"
- B.Size = Vector3.new(1, 1, 1)
- B.Transparency = 1
- B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
- B.Parent = Character
- local W = Instance.new("Weld")
- W.Part0 = Limb
- W.Part1 = B
- W.C0 = CFrame.new(0, -0.5, 0)
- W.Parent = Limb
- end
- --[
- local Bar = Instance.new("Part")
- Bar.TopSurface = 0
- Bar.BottomSurface = 0
- Bar.formFactor = "Symmetric"
- Bar.Size = Vector3.new(1, 1, 1)
- Bar.Transparency = 1
- Bar.CFrame = Torso.CFrame * CFrame.new(0, 0.5, 0)
- Bar.Parent = Character
- local Weld = Instance.new("Weld")
- Weld.Part0 = Torso
- Weld.Part1 = Bar
- Weld.C0 = CFrame.new(0, 0.5, 0)
- Weld.Parent = Torso
- --]]
- end
- end
- end))
- Motor6D12.Name = "Left Shoulder"
- Motor6D12.Parent = Tool0
- Motor6D12.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D12.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D12.DesiredAngle = -0.037995081394911
- Motor6D12.MaxVelocity = 0.15000000596046
- Motor6D13.Name = "Left Hip"
- Motor6D13.Parent = Tool0
- Motor6D13.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D13.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
- Motor6D13.DesiredAngle = 0.037995081394911
- Motor6D13.MaxVelocity = 0.10000000149012
- Motor6D14.Name = "Right Hip"
- Motor6D14.Parent = Tool0
- Motor6D14.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D14.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D14.DesiredAngle = 0.037995081394911
- Motor6D14.MaxVelocity = 0.10000000149012
- Motor6D15.Name = "Neck"
- Motor6D15.Parent = Tool0
- Motor6D15.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D15.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
- Motor6D15.MaxVelocity = 0.10000000149012
- Motor6D16.Name = "Right Shoulder"
- Motor6D16.Parent = Tool0
- Motor6D16.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D16.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
- Motor6D16.DesiredAngle = -0.037995081394911
- Motor6D16.MaxVelocity = 0.15000000596046
- Script17.Name = "RayGun"
- Script17.Parent = Tool0
- table.insert(cors,sandbox(Script17,function()
- local Tool = script.Parent;
- enabled = true
- local spark = Instance.new("Sparkles")
- spark.Color = Color3.new(1,1,0)
- function fire(v)
- local vCharacter = Tool.Parent
- local vPlayer = game.Players:playerFromCharacter(vCharacter)
- local missile = Instance.new("Part")
- spark:Clone().Parent = missile
- local spawnPos = vCharacter.PrimaryPart.Position
- local PewPew = Tool.Handle:FindFirstChild("PewPew")
- if (PewPew == nil) then
- PewPew = Instance.new("Sound")
- PewPew.Name = "PewPew"
- PewPew.SoundId = "http://www.roblox.com/asset/?id=13775480"
- PewPew.Parent = Tool.Handle
- PewPew.Pitch = 0.5
- PewPew.Volume = 1
- end
- spawnPos = spawnPos + (v * 10)
- missile.Position = spawnPos
- missile.Size = Vector3.new(1,1,1)
- missile.Velocity = v * 180
- missile.BrickColor = BrickColor.new(1004)
- missile.Shape = 0
- missile.BottomSurface = 0
- missile.TopSurface = 0
- missile.Name = "Spark"
- missile.Reflectance = .5
- local force = Instance.new("BodyForce")
- force.force = Vector3.new(0,98,0)
- force.Parent = missile
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = vPlayer
- creator_tag.Name = "creator"
- creator_tag.Parent = missile
- local new_script = script.Parent.LaserBlast:clone()
- new_script.Disabled = false
- new_script.Parent = missile
- missile.Parent = Tool.Parent
- PewPew:Play()
- end
- function gunUp()
- Tool.GripForward = Vector3.new(0,.981,-.196)
- Tool.GripRight = Vector3.new(1,0,0)
- Tool.GripUp = Vector3.new(0,.196,.981)
- end
- function gunOut()
- Tool.GripForward = Vector3.new(0,1,0)
- Tool.GripRight = Vector3.new(1,0,0)
- Tool.GripUp = Vector3.new(0,0,1)
- end
- function onActivated()
- if not enabled then
- return
- end
- enabled = false
- local character = Tool.Parent;
- local humanoid = character.Humanoid
- if humanoid == nil then
- print("Humanoid not found")
- return
- end
- local targetPos = humanoid.TargetPoint
- local lookAt = (targetPos - character.Head.Position).unit
- local reload = .1
- gunUp()
- fire(lookAt)
- wait(reload)
- gunOut()
- wait(reload)
- enabled = true
- end
- function onEquipped()
- Tool.Handle.EquipSound:play()
- end
- script.Parent.Activated:connect(onActivated)
- script.Parent.Equipped:connect(onEquipped)
- end))
- LocalScript18.Name = "Local Gui"
- LocalScript18.Parent = Tool0
- table.insert(cors,sandbox(LocalScript18,function()
- local Tool = script.Parent;
- enabled = true
- function onButton1Down(mouse)
- if not enabled then
- return
- end
- enabled = false
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- wait(.2)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- enabled = true
- end
- function onEquippedLocal(mouse)
- if mouse == nil then
- print("Mouse not found")
- return
- end
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- end
- Tool.Equipped:connect(onEquippedLocal)
- end))
- LocalScript19.Name = "Crouch"
- LocalScript19.Parent = Tool0
- table.insert(cors,sandbox(LocalScript19,function()
- on = 0
- Tool = script.Parent
- welds = {}
- sh = {}
- arms = nil
- torso = nil
- f = nil
- function Crouch(ison)
- if arms == nil and torso == nil then
- arms = {Tool.Parent:FindFirstChild("Left Leg"), Tool.Parent:FindFirstChild("Right Leg")}
- torso = Tool.Parent:FindFirstChild("Torso")
- end
- if arms ~= nil and torso ~= nil then
- sh = {torso:FindFirstChild("Left Hip"), torso:FindFirstChild("Right Hip")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- if ison == 1 then
- sh[1].Part1 = nil
- sh[2].Part1 = nil
- local weld1 = Instance.new("Weld")
- weld1.Part0 = torso
- weld1.Parent = torso
- weld1.Part1 = arms[1]
- weld1.C1 = CFrame.new(-0.5, 0.75, 1)
- arms[1].Name = "LDave"
- arms[1].CanCollide = true
- welds[1] = weld1
- -------------------------------------------
- local weld2 = Instance.new("Weld")
- weld2.Part0 = torso
- weld2.Parent = torso
- weld2.Part1 = arms[2]
- weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
- arms[2].Name = "RDave"
- arms[2].CanCollide = true
- welds[2] = weld2
- ---------------------------------
- local force = Instance.new("BodyForce")
- force.Parent = torso
- f = force
- wait(0.01)
- elseif ison == 0 then
- if arms then
- sh[1].Part1 = arms[1]
- sh[2].Part1 = arms[2]
- f.Parent = nil
- arms[2].Name = "Right Leg"
- arms[1].Name = "Left Leg"
- welds[1].Parent = nil
- welds[2].Parent = nil
- end
- end
- --
- end
- else
- print("sh")
- end
- else
- print("arms")
- end
- end
- function Key(key)
- if key then
- key = string.lower(key)
- if (key=="c") then
- if on == 1 then
- on = 0
- elseif on == 0 then
- on = 1
- end
- Crouch(on)
- end
- end
- end
- function Equip(mouse)
- mouse.KeyDown:connect(Key)
- end
- script.Parent.Equipped:connect(Equip)
- end))
- Tool20.Name = "Physics Gun"
- Tool20.Parent = mas
- Tool20.CanBeDropped = false
- Part21.Name = "Handle"
- Part21.Parent = Tool20
- Part21.Material = Enum.Material.Neon
- Part21.BrickColor = BrickColor.new("Cyan")
- Part21.Transparency = 1
- Part21.CanCollide = false
- Part21.FormFactor = Enum.FormFactor.Custom
- Part21.Size = Vector3.new(1, 0.400000036, 0.300000012)
- Part21.CFrame = CFrame.new(0.149997994, 0.686568975, -12.9999981, 1, -4.82296491e-05, -1.3726883e-06, 4.82297946e-05, 1, -1.89604953e-06, 1.37278903e-06, 1.89598336e-06, 1)
- Part21.BottomSurface = Enum.SurfaceType.Smooth
- Part21.TopSurface = Enum.SurfaceType.Smooth
- Part21.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- Part21.Position = Vector3.new(0.149997994, 0.686568975, -12.9999981)
- Part21.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- CylinderMesh22.Parent = Part21
- CylinderMesh22.Scale = Vector3.new(0.100000001, 0.100000001, 0.100000001)
- CylinderMesh22.Scale = Vector3.new(0.100000001, 0.100000001, 0.100000001)
- Part23.Name = "Shoot"
- Part23.Parent = Tool20
- Part23.Material = Enum.Material.Neon
- Part23.BrickColor = BrickColor.new("Cyan")
- Part23.Reflectance = 0.30000001192093
- Part23.Transparency = 1
- Part23.Rotation = Vector3.new(106, -45, -90)
- Part23.CanCollide = false
- Part23.FormFactor = Enum.FormFactor.Custom
- Part23.Size = Vector3.new(1, 1, 1)
- Part23.CFrame = CFrame.new(0.79999876, 0.817569196, -13.8999977, -4.93427106e-05, 0.707106769, -0.707106769, 0.275634497, -0.67970562, -0.679724872, -0.961262524, -0.194936559, -0.194869474)
- Part23.BottomSurface = Enum.SurfaceType.Smooth
- Part23.TopSurface = Enum.SurfaceType.Smooth
- Part23.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- Part23.Position = Vector3.new(0.79999876, 0.817569196, -13.8999977)
- Part23.Orientation = Vector3.new(42.8199997, -105.409996, 157.929993)
- Part23.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- SpecialMesh24.Parent = Part23
- SpecialMesh24.MeshId = "http://www.roblox.com/asset/?id=1031410"
- SpecialMesh24.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- SpecialMesh24.MeshType = Enum.MeshType.FileMesh
- SpecialMesh24.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
- LocalScript25.Parent = Tool20
- table.insert(cors,sandbox(LocalScript25,function()
- -- Variables for services
- local render = game:GetService("RunService").RenderStepped
- local contextActionService = game:GetService("ContextActionService")
- local userInputService = game:GetService("UserInputService")
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local Tool = script.Parent
- -- Variables for Module Scripts
- local screenSpace = require(Tool:WaitForChild("ScreenSpace"))
- local connection
- -- Variables for character joints
- local neck, shoulder, oldNeckC0, oldShoulderC0
- local mobileShouldTrack = true
- -- Thourough check to see if a character is sitting
- local function amISitting(character)
- local t = character.Torso
- for _, part in pairs(t:GetConnectedParts(true)) do
- if part:IsA("Seat") or part:IsA("VehicleSeat") then
- return true
- end
- end
- end
- -- Function to call on renderstepped. Orients the character so it is facing towards
- -- the player mouse's position in world space. If character is sitting then the torso
- -- should not track
- local function frame(mousePosition)
- -- Special mobile consideration. We don't want to track if the user was touching a ui
- -- element such as the movement controls. Just return out of function if so to make sure
- -- character doesn't track
- if not mobileShouldTrack then return end
- -- Make sure character isn't swiming. If the character is swimming the following code will
- -- not work well; the character will not swim correctly. Besides, who shoots underwater?
- if player.Character.Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
- local torso = player.Character.Torso
- local head = player.Character.Head
- local toMouse = (mousePosition - head.Position).unit
- local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
- local neckAngle = angle
- -- Limit how much the head can tilt down. Too far and the head looks unnatural
- if math.deg(neckAngle) > 110 then
- neckAngle = math.rad(110)
- end
- neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
- -- Calculate horizontal rotation
- local arm = player.Character:FindFirstChild("Right Arm")
- local fromArmPos = torso.Position + torso.CFrame:vectorToWorldSpace(Vector3.new(
- torso.Size.X/2 + arm.Size.X/2, torso.Size.Y/2 - arm.Size.Z/2, 0))
- local toMouseArm = ((mousePosition - fromArmPos) * Vector3.new(1,0,1)).unit
- local look = (torso.CFrame.lookVector * Vector3.new(1,0,1)).unit
- local lateralAngle = math.acos(toMouseArm:Dot(look))
- -- Check for rogue math
- if tostring(lateralAngle) == "-1.#IND" then
- lateralAngle = 0
- end
- -- Handle case where character is sitting down
- if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
- local cross = torso.CFrame.lookVector:Cross(toMouseArm)
- if lateralAngle > math.pi/2 then
- lateralAngle = math.pi/2
- end
- if cross.Y < 0 then
- lateralAngle = -lateralAngle
- end
- end
- -- Turn shoulder to point to mouse
- shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2 + lateralAngle,0)
- -- If not sitting then aim torso laterally towards mouse
- if not amISitting(player.Character) then
- torso.CFrame = CFrame.new(torso.Position, torso.Position + (Vector3.new(
- mousePosition.X, torso.Position.Y, mousePosition.Z)-torso.Position).unit)
- else
- --print("sitting")
- end
- end
- end
- -- Function to bind to render stepped if player is on PC
- local function pcFrame()
- frame(mouse.Hit.p)
- end
- -- Function to bind to touch moved if player is on mobile
- local function mobileFrame(touch, processed)
- -- Check to see if the touch was on a UI element. If so, we don't want to update anything
- if not processed then
- -- Calculate touch position in world space. Uses Stravant's ScreenSpace Module script
- -- to create a ray from the camera.
- local test = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1)
- local nearPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1))
- nearPos = game.Workspace.CurrentCamera.CoordinateFrame.p - nearPos
- local farPos = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y,50)
- farPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(farPos) * -1
- if farPos.magnitude > 900 then
- farPos = farPos.unit * 900
- end
- local ray = Ray.new(nearPos, farPos)
- local part, pos = game.Workspace:FindPartOnRay(ray, player.Character)
- -- if a position was found on the ray then update the character's rotation
- if pos then
- frame(pos)
- end
- end
- end
- local oldIcon = nil
- -- Function to bind to equip event
- local function equip()
- local torso = player.Character.Torso
- -- Setup joint variables
- neck = torso.Neck
- oldNeckC0 = neck.C0
- shoulder = torso:FindFirstChild("Right Shoulder")
- oldShoulderC0 = shoulder.C0
- -- Remember old mouse icon and update current
- oldIcon = mouse.Icon
- mouse.Icon = "http://www.roblox.com/asset/?id=170477320"
- -- Bind TouchMoved event if on mobile. Otherwise connect to renderstepped
- if userInputService.TouchEnabled then
- connection = userInputService.TouchMoved:connect(mobileFrame)
- else
- connection = render:connect(pcFrame)
- end
- -- Bind TouchStarted and TouchEnded. Used to determine if character should rotate
- -- during touch input
- userInputService.TouchStarted:connect(function(touch, processed)
- mobileShouldTrack = not processed
- end)
- userInputService.TouchEnded:connect(function(touch, processed)
- mobileShouldTrack = false
- end)
- -- Fire server's equip event
- game.ReplicatedStorage.ROBLOX_PistolEquipEvent:FireServer()
- -- Bind event for when mouse is clicked to fire server's fire event
- mouse.Button1Down:connect(function()
- game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p)
- end)
- -- Bind reload event to mobile button and r key
- contextActionService:BindActionToInputTypes("Reload", function()
- game.ReplicatedStorage.ROBLOX_PistolReloadEvent:FireServer()
- end, true, "")
- -- If game uses filtering enabled then need to update server while tool is
- -- held by character.
- if workspace.FilteringEnabled then
- while connection do
- wait()
- game.ReplicatedStorage.ROBLOX_PistolUpdateEvent:FireServer(neck.C0, shoulder.C0)
- end
- end
- end
- -- Function to bind to Unequip event
- local function unequip()
- if connection then connection:disconnect() end
- contextActionService:UnbindAction("Reload")
- game.ReplicatedStorage.ROBLOX_PistolUnequipEvent:FireServer()
- mouse.Icon = oldIcon
- neck.C0 = oldNeckC0
- shoulder.C0 = oldShoulderC0
- end
- -- Bind tool events
- Tool.Equipped:connect(equip)
- Tool.Unequipped:connect(unequip)
- end))
- Script26.Name = "qPerfectionWeld"
- Script26.Parent = Tool20
- table.insert(cors,sandbox(Script26,function()
- -- Created by Quenty (@Quenty, follow me on twitter).
- -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
- -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
- --[[ INSTRUCTIONS
- - Place in the model
- - Make sure model is anchored
- - That's it. It will weld the model and all children.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
- This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
- ]]
- --[[ DOCUMENTATION
- - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
- - Will work in PBS servers
- - Will work as long as it starts out with the part anchored
- - Stores the relative CFrame as a CFrame value
- - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
- - Utilizes a recursive algorith to find all parts in the model
- - Will reweld on script reparent if the script is initially parented to a tool.
- - Welds as fast as possible
- ]]
- -- qPerfectionWeld.lua
- -- Created 10/6/2014
- -- Author: Quenty
- -- Version 1.0.3
- -- Updated 10/14/2014 - Updated to 1.0.1
- --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
- -- Updated 10/14/2014 - Updated to 1.0.2
- --- Fixed bug fix.
- -- Updated 10/14/2014 - Updated to 1.0.3
- --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
- local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
- local function CallOnChildren(Instance, FunctionToCall)
- -- Calls a function on each of the children of a certain object, using recursion.
- FunctionToCall(Instance)
- for _, Child in next, Instance:GetChildren() do
- CallOnChildren(Child, FunctionToCall)
- end
- end
- local function GetNearestParent(Instance, ClassName)
- -- Returns the nearest parent of a certain class, or returns nil
- 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 = {}
- -- if StartInstance:IsA("BasePart") then
- -- List[#List+1] = StartInstance
- -- end
- CallOnChildren(StartInstance, function(Item)
- if Item:IsA("BasePart") then
- List[#List+1] = Item;
- end
- end)
- return List
- end
- local function Modify(Instance, Values)
- -- Modifies an Instance by using a table.
- 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)
- -- Using a syntax hack to create a nice way to Make new items.
- 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)
- --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
- -- definitely some edge cases.
- 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)
- --- Weld's 2 parts together
- -- @param Part0 The first part
- -- @param Part1 The second part (Dependent part most of the time).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
- -- @return The weld created.
- 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, DoNotUnanchor)
- -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
- -- @param MainPart The part to weld the model to (can be in the model).
- -- @param [JointType] The type of joint. Defaults to weld.
- -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
- 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
- if not DoNotUnanchor then
- for _, Part in pairs(Parts) do
- Part.Anchored = false
- end
- MainPart.Anchored = false
- end
- end
- local function PerfectionWeld()
- local Tool = GetNearestParent(script, "Tool")
- local Parts = GetBricks(script.Parent)
- local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
- if PrimaryPart then
- WeldParts(Parts, PrimaryPart, "Weld", false)
- else
- warn("qWeld - Unable to weld part")
- end
- return Tool
- end
- local Tool = PerfectionWeld()
- if Tool and script.ClassName == "Script" then
- --- Don't bother with local scripts
- script.Parent.AncestryChanged:connect(function()
- PerfectionWeld()
- end)
- end
- -- Created by Quenty (@Quenty, follow me on twitter).
- end))
- LocalScript27.Name = "AnimateScript(EM-500)"
- LocalScript27.Parent = Tool20
- table.insert(cors,sandbox(LocalScript27,function()
- local arms = nil
- local torso = nil
- local welds = {}
- local Tool = script.Parent
- local neck = nil
- local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- function Equip(mouse)
- wait(0.01)
- arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
- head = Tool.Parent:FindFirstChild("Head")
- torso = Tool.Parent:FindFirstChild("Torso")
- if neck == nil then
- neck = Tool.Parent:FindFirstChild("Torso").Neck
- end
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- sh[1].Part1 = nil
- sh[2].Part1 = nil
- local weld1 = Instance.new("Weld")
- weld1.Part0 = head
- weld1.Parent = head
- weld1.Part1 = arms[1]
- welds[1] = weld1
- local weld2 = Instance.new("Weld")
- weld2.Part0 = head
- weld2.Parent = head
- weld2.Part1 = arms[2]
- welds[2] = weld2
- -------------------------here
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- mouse.Move:connect(function ()
- --local Direction = Tool.Direction.Value
- local Direction = mouse.Hit.p
- local b = head.Position.Y-Direction.Y
- local dist = (head.Position-Direction).magnitude
- local answer = math.asin(b/dist)
- neck.C0=orginalC0*CFrame.fromEulerAnglesXYZ(answer,0,0)
- wait(0.1)
- end)end
- else
- print("sh")
- end
- else
- print("arms")
- end
- end
- function Unequip(mouse)
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- neck.C0 = orginalC0
- sh[1].Part1 = arms[1]
- sh[2].Part1 = arms[2]
- welds[1].Parent = nil
- welds[2].Parent = nil
- end
- else
- print("sh")
- end
- else
- print("arms")
- end
- end
- Tool.Equipped:connect(Equip)
- Tool.Unequipped:connect(Unequip)
- function Animate()
- arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
- if Tool.AnimateValue.Value == "Shoot" then
- local weld1 = welds[1]
- local weld2 = welds[2]
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.05, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.1, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.3, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.35, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- Tool.AnimateValue.Value = "None"
- end
- if Tool.AnimateValue.Value == "Reload" then
- local weld1 = welds[1]
- local weld2 = welds[2]
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-100), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-105), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.45, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.9, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.5, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.55, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1.1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.57, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1.2, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1.3, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- Tool.AnimateValue.Value = "None"
- end
- end
- Tool.AnimateValue.Changed:connect(Animate)
- end))
- Script28.Name = "LineConnect"
- Script28.Parent = Tool20
- Script28.Disabled = true
- table.insert(cors,sandbox(Script28,function()
- wait()
- local check = script.Part2
- local part1 = script.Part1.Value
- local part2 = script.Part2.Value
- local parent = script.Par.Value
- local color = script.Color
- local line = Instance.new("Part")
- line.TopSurface = 0
- line.BottomSurface = 0
- line.Reflectance = .5
- line.Name = "Laser"
- line.Locked = true
- line.CanCollide = false
- line.Anchored = true
- line.formFactor = 0
- line.Size = Vector3.new(1,1,1)
- local mesh = Instance.new("BlockMesh")
- mesh.Parent = line
- while true do
- if (check.Value==nil) then break end
- if (part1==nil or part2==nil or parent==nil) then break end
- if (part1.Parent==nil or part2.Parent==nil) then break end
- if (parent.Parent==nil) then break end
- local lv = CFrame.new(part1.Position,part2.Position)
- local dist = (part1.Position-part2.Position).magnitude
- line.Parent = parent
- line.Material = "Neon"
- line.BrickColor = color.Value.BrickColor
- line.Reflectance = color.Value.Reflectance
- line.Transparency = "0.2"
- line.CFrame = CFrame.new(part1.Position+lv.lookVector*dist/2)
- line.CFrame = CFrame.new(line.Position,part2.Position)
- mesh.Scale = Vector3.new(.25,.25,dist)
- wait()
- end
- line:remove()
- script:remove()
- end))
- LocalScript29.Name = "MainScript"
- LocalScript29.Parent = Tool20
- table.insert(cors,sandbox(LocalScript29,function()
- wait()
- tool = script.Parent
- lineconnect = tool.LineConnect
- object = nil
- mousedown = false
- found = false
- BP = Instance.new("BodyPosition")
- BP.maxForce = Vector3.new(math.huge*math.huge,math.huge*math.huge,math.huge*math.huge) --pwns everyone elses bodyposition
- BP.P = BP.P*10 --faster movement. less bounceback.
- dist = nil
- point = Instance.new("Part")
- point.Locked = true
- point.Anchored = true
- point.formFactor = 0
- point.Shape = 0
- point.BrickColor = BrickColor.new("Toothpaste")
- point.Size = Vector3.new(1,1,1)
- point.CanCollide = false
- local mesh = Instance.new("SpecialMesh")
- mesh.MeshType = "Sphere"
- mesh.Scale = Vector3.new(.35,.35,.35)
- mesh.Parent = point
- handle = tool.Shoot
- front = tool.Shoot
- color = tool.Shoot
- objval = nil
- local hooked = false
- local hookBP = BP:clone()
- hookBP.maxForce = Vector3.new(30000,30000,30000)
- function LineConnect(part1,part2,parent)
- local p1 = Instance.new("ObjectValue")
- p1.Value = part1
- p1.Name = "Part1"
- local p2 = Instance.new("ObjectValue")
- p2.Value = part2
- p2.Name = "Part2"
- local par = Instance.new("ObjectValue")
- par.Value = parent
- par.Name = "Par"
- local col = Instance.new("ObjectValue")
- col.Value = color
- col.Name = "Color"
- local s = lineconnect:clone()
- s.Disabled = false
- p1.Parent = s
- p2.Parent = s
- par.Parent = s
- col.Parent = s
- s.Parent = workspace
- if (part2==object) then
- objval = p2
- end
- end
- function onButton1Down(mouse)
- if (mousedown==true) then return end
- mousedown = true
- coroutine.resume(coroutine.create(function()
- local p = point:clone()
- p.Parent = tool
- LineConnect(front,p,workspace)
- while (mousedown==true) do
- p.Parent = tool
- if (object==nil) then
- if (mouse.Target==nil) then
- local lv = CFrame.new(front.Position,mouse.Hit.p)
- p.CFrame = CFrame.new(front.Position+(lv.lookVector*1000))
- else
- p.CFrame = CFrame.new(mouse.Hit.p)
- end
- else
- LineConnect(front,object,workspace)
- break
- end
- wait()
- end
- p:remove()
- end))
- while (mousedown==true) do
- if (mouse.Target~=nil) then
- local t = mouse.Target
- if (t.Anchored==false) then
- object = t
- dist = (object.Position-front.Position).magnitude
- break
- end
- end
- wait()
- end
- while (mousedown==true) do
- if (object.Parent==nil) then break end
- local lv = CFrame.new(front.Position,mouse.Hit.p)
- BP.Parent = object
- BP.position = front.Position+lv.lookVector*dist
- wait()
- end
- BP:remove()
- object = nil
- objval.Value = nil
- end
- function onKeyDown(key,mouse)
- local key = key:lower()
- local yesh = false
- if (key=="q") then
- if (dist>=5) then
- dist = dist-5
- end
- end
- if key == "" then
- if (object==nil) then return end
- for _,v in pairs(object:children()) do
- if v.className == "BodyGyro" then
- return nil
- end
- end
- BG = Instance.new("BodyGyro")
- BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
- BG.cframe = CFrame.new(object.CFrame.p)
- BG.Parent = object
- repeat wait() until(object.CFrame == CFrame.new(object.CFrame.p))
- BG.Parent = nil
- if (object==nil) then return end
- for _,v in pairs(object:children()) do
- if v.className == "BodyGyro" then
- v.Parent = nil
- end
- end
- object.Velocity = Vector3.new(0,0,0)
- object.RotVelocity = Vector3.new(0,0,0)
- end
- if (key=="e") then
- dist = dist+5
- end
- if (string.byte(key)==27) then
- if (object==nil) then return end
- local e = Instance.new("Explosion")
- e.Parent = workspace
- e.Position = object.Position
- color.BrickColor = BrickColor.Black()
- point.BrickColor = BrickColor.White()
- wait(.48)
- color.BrickColor = BrickColor.White()
- point.BrickColor = BrickColor.Black()
- end
- if (key=="") then
- if not hooked then
- if (object==nil) then return end
- hooked = true
- hookBP.position = object.Position
- if tool.Parent:findFirstChild("Torso") then
- hookBP.Parent = tool.Parent.Torso
- if dist ~= (object.Size.x+object.Size.y+object.Size.z)+5 then
- dist = (object.Size.x+object.Size.y+object.Size.z)+5
- end
- end
- else
- hooked = false
- hookBP.Parent = nil
- end
- end
- if (key=="r") then
- if (object==nil) then return end
- color.BrickColor = BrickColor.new("Toothpaste")
- point.BrickColor = BrickColor.new("Toothpaste")
- object.Parent = nil
- wait(.48)
- color.BrickColor = BrickColor.new("Toothpaste")
- point.BrickColor = BrickColor.new("Toothpaste")
- end
- if (key=="") then
- if (object==nil) then return end
- local New = object:clone()
- New.Parent = object.Parent
- for _,v in pairs(New:children()) do
- if v.className == "BodyPosition" or v.className == "BodyGyro" then
- v.Parent = nil
- end
- end
- object = New
- mousedown = false
- mousedown = true
- LineConnect(front,object,workspace)
- while (mousedown==true) do
- if (object.Parent==nil) then break end
- local lv = CFrame.new(front.Position,mouse.Hit.p)
- BP.Parent = object
- BP.position = front.Position+lv.lookVector*dist
- wait()
- end
- BP:remove()
- object = nil
- objval.Value = nil
- end
- if (key=="") then
- local Cube = Instance.new("Part")
- Cube.Locked = true
- Cube.Size = Vector3.new(4,4,4)
- Cube.formFactor = 0
- Cube.TopSurface = 0
- Cube.BottomSurface = 0
- Cube.Name = "WeightedStorageCube"
- Cube.Parent = workspace
- Cube.CFrame = CFrame.new(mouse.Hit.p) + Vector3.new(0,2,0)
- for i = 0,5 do
- local Decal = Instance.new("Decal")
- Decal.Texture = "http://www.roblox.com/asset/?id=2662260"
- Decal.Face = i
- Decal.Name = "WeightedStorageCubeDecal"
- Decal.Parent = Cube
- end
- end
- if (key=="") then
- if dist ~= 15 then
- dist = 15
- end
- end
- end
- function onEquipped(mouse)
- keymouse = mouse
- local char = tool.Parent
- human = char.Humanoid
- human.Changed:connect(function() if (human.Health==0) then mousedown = false BP:remove() point:remove() tool:remove() end end)
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- mouse.Button1Up:connect(function() mousedown = false end)
- mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- end
- tool.Equipped:connect(onEquipped)
- end))
- Part30.Parent = Tool20
- Part30.Material = Enum.Material.Neon
- Part30.BrickColor = BrickColor.new("Cyan")
- Part30.Transparency = 0.5
- Part30.Rotation = Vector3.new(180, -75, -180)
- Part30.Shape = Enum.PartType.Cylinder
- Part30.Size = Vector3.new(1.20000005, 0.649999976, 2)
- Part30.CFrame = CFrame.new(0.699998736, 0.763569236, -13.2999983, -0.258819044, 7.17242793e-11, -0.965925813, -1.89857019e-11, 1, -6.84963197e-11, 0.965925813, 0, -0.258819044)
- Part30.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- Part30.Position = Vector3.new(0.699998736, 0.763569236, -13.2999983)
- Part30.Orientation = Vector3.new(0, -105, 0)
- Part30.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- Script31.Name = "Glow Script"
- Script31.Parent = Part30
- table.insert(cors,sandbox(Script31,function()
- while true do
- wait(0.05)
- script.Parent.Transparency = .5
- wait(0.05)
- script.Parent.Transparency = .6
- wait(0.05)
- script.Parent.Transparency = .7
- wait(0.05)
- script.Parent.Transparency = .8
- wait(0.05)
- script.Parent.Transparency = .9
- wait(0.05)
- script.Parent.Transparency = .8
- wait(0.05)
- script.Parent.Transparency = .7
- wait(0.05)
- script.Parent.Transparency = .6
- wait(0.05)
- script.Parent.Transparency = .5
- end
- end))
- Tool32.Name = "Portal Gun"
- Tool32.Parent = mas
- Tool32.GripForward = Vector3.new(-0.102732286, 0.994709015, -0)
- Tool32.GripPos = Vector3.new(-0.63109529, 0.452967376, -0.402335078)
- Tool32.GripRight = Vector3.new(0.994709015, 0.102732286, -0.000126240688)
- Tool32.GripUp = Vector3.new(0.000125572755, 1.29689943e-05, 1)
- LocalScript33.Name = "AnimateScript(EM-500)"
- LocalScript33.Parent = Tool32
- table.insert(cors,sandbox(LocalScript33,function()
- local MOUSE_ICON = 'rbxassetid://120192974' local Tool = script.Parent
- local Mouse = nil local function UpdateIcon()
- if Mouse then Mouse.Icon = Tool.Enabled and MOUSE_ICON end end local function OnEquipped(mouse) Mouse = mouse UpdateIcon() end local function OnChanged(property)
- if property == 'Enabled' then UpdateIcon() end end Tool.Equipped:connect(OnEquipped) Tool.Changed:connect(OnChanged)
- local arms = nil
- local torso = nil
- local welds = {}
- local Tool = script.Parent
- local neck = nil
- local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
- function Equip(mouse)
- wait(0.01)
- arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
- head = Tool.Parent:FindFirstChild("Head")
- torso = Tool.Parent:FindFirstChild("Torso")
- if neck == nil then
- neck = Tool.Parent:FindFirstChild("Torso").Neck
- end
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- sh[1].Part1 = nil
- sh[2].Part1 = nil
- local weld1 = Instance.new("Weld")
- weld1.Part0 = head
- weld1.Parent = head
- weld1.Part1 = arms[1]
- welds[1] = weld1
- local weld2 = Instance.new("Weld")
- weld2.Part0 = head
- weld2.Parent = head
- weld2.Part1 = arms[2]
- welds[2] = weld2
- -------------------------here
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- mouse.Move:connect(function ()
- --local Direction = Tool.Direction.Value
- local Direction = mouse.Hit.p
- local b = head.Position.Y-Direction.Y
- local dist = (head.Position-Direction).magnitude
- local answer = math.asin(b/dist)
- neck.C0=orginalC0*CFrame.fromEulerAnglesXYZ(answer,0,0)
- wait(0.1)
- end)end
- else
- print("sh")
- end
- else
- print("arms")
- end
- end
- function Unequip(mouse)
- if arms ~= nil and torso ~= nil then
- local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
- if sh ~= nil then
- local yes = true
- if yes then
- yes = false
- neck.C0 = orginalC0
- sh[1].Part1 = arms[1]
- sh[2].Part1 = arms[2]
- welds[1].Parent = nil
- welds[2].Parent = nil
- end
- else
- print("sh")
- end
- else
- print("arms")
- end
- end
- Tool.Equipped:connect(Equip)
- Tool.Unequipped:connect(Unequip)
- function Animate()
- arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
- if Tool.AnimateValue.Value == "Shoot" then
- local weld1 = welds[1]
- local weld2 = welds[2]
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.05, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.1, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.3, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.35, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.00001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- Tool.AnimateValue.Value = "None"
- end
- if Tool.AnimateValue.Value == "Reload" then
- local weld1 = welds[1]
- local weld2 = welds[2]
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-100), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-105), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.45, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.9, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.5, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.55, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1.1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.57, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1.2, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 1.3, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
- wait(0.0001)
- weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
- weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
- Tool.AnimateValue.Value = "None"
- end
- end
- Tool.AnimateValue.Changed:connect(Animate)
- end))
- LocalScript34.Parent = Tool32
- table.insert(cors,sandbox(LocalScript34,function()
- local tool = script.Parent
- local debris = game:GetService("Debris")
- local timestart = false
- local timer = 0
- local model = Instance.new("Model",game.Workspace)
- local colora = BrickColor.new(Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255))
- local colorb = BrickColor.new(Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255))
- print(colora)
- print(colorb)
- tool:WaitForChild("Settings")
- local pp = script.Parent.Settings.PortalPower
- local cw = script.Parent.Settings.CameraWait
- local cg --[[;^)]] = script.Parent.Settings.CanGrab
- local gp = script.Parent.Settings.GrabPower
- local gr = script.Parent.Settings.GrabRange
- script.Parent:WaitForChild("surface")
- funcs = require(script.Parent.surface)
- function gpos(part,pos,ignore)
- local r = Ray.new(part.Position,(pos-part.Position).unit*999)
- return workspace:FindPartOnRayWithIgnoreList(r,ignore)
- end
- tool.Equipped:connect(function (mouse)
- script.Parent.Handle.Anchored = false
- local player = game.Players.LocalPlayer
- local grabbed_object = nil
- model.Name = player.Name.."'s Portals"
- local canTeleport = true
- function getModelMass(model)
- if model == nil then return 0 end
- local mass = 0
- local function getModelMass(m)
- for i,v in pairs(m:GetChildren()) do
- if v:IsA("BasePart") then
- mass = mass + v:GetMass()
- elseif v:IsA("Model") then
- getModelMass(v)
- end
- end
- end
- getModelMass(model)
- return mass
- end
- function telePortal(hit, blue)
- if hit == grabbed_object then
- grabbed_object.Grab:Destroy()
- grabbed_object = nil
- end
- if model:findFirstChild("BluePortal") and model:findFirstChild("RedPortal") then
- if hit.Parent and hit.Parent ~= workspace and hit.Anchored == false then
- if getModelMass(hit.Parent) > 60 then return else
- if hit.Parent:findFirstChild("Torso") then
- hit = hit.Parent.Torso
- end
- end
- else
- if hit:getMass() > 60 or hit.Anchored then return end
- end
- local this
- local other
- if blue then
- this = model.BluePortal
- other = model.RedPortal
- else
- this = model.RedPortal
- other = model.BluePortal
- end
- local x = math.abs(hit.Velocity.x)
- local y = math.abs(hit.Velocity.y)
- local z = math.abs(hit.Velocity.z)
- local main = 0
- if x > y and x > z then
- main = x
- elseif y > x and y > z then
- main = y
- elseif z > x and z > y then
- main = z
- end
- main = math.ceil(main)
- local dir = other.CFrame.lookVector
- local spawn = other.CFrame.p + (dir*3)
- hit.CFrame = CFrame.new(spawn, spawn+dir*2)
- hit.Velocity = dir*main*pp.Value
- end
- end
- function makePortal(pos, hit, blue)
- local p = Instance.new("Part", model)
- if blue then p.Name = "BluePortal" else p.Name = "RedPortal" end
- if blue then p.BrickColor = colora else p.BrickColor = colorb end
- p.Material = Enum.Material.Neon
- p.FormFactor = Enum.FormFactor.Custom
- p.Size = Vector3.new(4,6,3)
- p.TopSurface = 0
- p.BottomSurface = 0
- p.Anchored = true
- local p2 = Instance.new("Part", model)
- p2.Size = Vector3.new(0.2,0.2,0.2)
- p2.CanCollide = false
- p2.TopSurface = 0
- p2.BottomSurface = 0
- p2.BrickColor = p.BrickColor
- if blue then
- p2.Name = "BP"
- else
- p2.Name = "RP"
- end
- local sm2 = Instance.new("SpecialMesh", p2)
- sm2.Scale = Vector3.new(0.45, 0.3, 0.0018)
- sm2.MeshId = "rbxassetid://431119824"
- local sm = Instance.new("SpecialMesh",p)
- sm.MeshType = "Sphere"
- sm.Scale = Vector3.new(1,1,0.01)
- p.CanCollide = false
- local dir = funcs.getSide(hit,funcs.surface(hit,pos))
- p.CFrame = CFrame.new(pos, pos + dir)
- p2.CFrame = p.CFrame * CFrame.Angles(0,0,math.pi/2)
- funcs.weld(p2,p)
- if hit.Anchored == false then
- local pos = p.CFrame:inverse() * hit.CFrame
- funcs.weld(p,hit)
- p.Anchored = false
- p.ChildRemoved:connect(function (c)
- if c.Name == "Weld" then
- p:Destroy()
- p2:Destroy()
- end
- end)
- end
- p.Touched:connect(funcs.debounce(function (h) if canTeleport then canTeleport = false telePortal(h,blue) wait(.1) canTeleport = true end end))
- end
- function firePortal(origin,dir,blue,chit,target)
- local p = Instance.new("Part", game.Workspace)
- p.FormFactor = Enum.FormFactor.Custom
- p.Size = Vector3.new(.1,.1,.1)
- p.TopSurface = 0
- p.BottomSurface = 0
- if blue then
- p.BrickColor = colora
- else
- p.BrickColor = colorb
- end
- p.Material = Enum.Material.Neon
- local sm = Instance.new("SpecialMesh",p)
- sm.MeshType = "Sphere"
- sm.Scale = Vector3.new(10,10,10)
- p.Reflectance = 1
- local bf = Instance.new("BodyForce",p)
- bf.force = Vector3.new(0,196.2,0)*p:GetMass()
- p.Velocity = dir*200
- p.CFrame = CFrame.new(origin,origin+dir)
- p:BreakJoints()
- tool.Fire:Play()
- funcs.debounce(p.Touched:connect(function (h)
- if blue and target then
- if model:FindFirstChild("BluePortal") then model.BluePortal:Destroy() end
- if model:FindFirstChild("BP") then model.BP:Destroy() end
- makePortal(chit,target,true)
- elseif not blue and target then
- if model:FindFirstChild("RedPortal") then model.RedPortal:Destroy() end
- if model:FindFirstChild("RP") then model.RP:Destroy() end
- makePortal(chit,target,false)
- end
- p:Destroy()
- end))
- debris:AddItem(p,120)
- end
- funcs.debounce(mouse.Button2Down:connect(function ()
- timestart = false
- wait(cw.Value)
- timestart = true
- end))
- funcs.debounce(mouse.Button1Down:connect(function ()
- local dir = (mouse.Hit.p - player.Character.Head.Position).unit
- local origin = player.Character.Head.Position + dir*5
- local block, pos = gpos(tool.Handle,mouse.Hit.p,{tool.Parent,model,grabbed_object})
- firePortal(origin,dir,true,pos,block)
- end))
- funcs.debounce(mouse.Button2Up:connect(function ()
- if timestart then return end
- local dir = (mouse.Hit.p - player.Character.Head.Position).unit
- local origin = player.Character.Head.Position + dir*5
- local block, pos = gpos(tool.Handle,mouse.Hit.p,{tool.Parent,model,grabbed_object})
- firePortal(origin,dir,false,pos,block)
- end))
- funcs.debounce(mouse.KeyDown:connect(function (k)
- local mt = mouse.Target
- if mt then
- if k == "e" and cg.Value then
- if grabbed_object == nil and (mt.Position - tool.Handle.Position).magnitude < gr.Value then
- if mt:getMass() > gp.Value then return end
- mt.CFrame = tool.Handle.CFrame * CFrame.new(0,6,0)
- local w = funcs.weld(mt, tool.Handle)
- w.Name = "Grab"
- grabbed_object = mt
- elseif grabbed_object then
- grabbed_object.Grab:Destroy()
- grabbed_object.Velocity = tool.Parent.Torso.CFrame.lookVector*100
- grabbed_object = nil
- end
- end
- end
- if k == "r" then
- model:ClearAllChildren()
- end
- end))
- local event = workspace.ChildRemoved:connect(function (c)
- if c == model then
- model = Instance.new("Model", workspace)
- model.Name = player.Name.."'s Portals"
- end
- end)
- player.Character.Humanoid.Died:connect(function ()
- event:disconnect()
- model:Destroy()
- end)
- end)
- tool.Unequipped:connect(function ()
- if tool.Parent == game.Workspace then
- model:Destroy()
- model = Instance.new("Model", workspace)
- end
- end)
- end))
- Configuration35.Name = "Settings"
- Configuration35.Parent = Tool32
- NumberValue36.Name = "PortalPower"
- NumberValue36.Parent = Configuration35
- NumberValue36.Value = 1
- NumberValue37.Name = "CameraWait"
- NumberValue37.Parent = Configuration35
- NumberValue37.Value = 0.65
- BoolValue38.Name = "CanGrab"
- BoolValue38.Parent = Configuration35
- BoolValue38.Value = true
- NumberValue39.Name = "GrabPower"
- NumberValue39.Parent = Configuration35
- NumberValue39.Value = 100
- NumberValue40.Name = "GrabRange"
- NumberValue40.Parent = Configuration35
- NumberValue40.Value = 5
- Sound41.Name = "Fire"
- Sound41.Parent = Tool32
- Sound41.SoundId = "rbxassetid://142774034"
- LocalScript42.Name = "MouseIcon"
- LocalScript42.Parent = Tool32
- LocalScript42.Disabled = true
- table.insert(cors,sandbox(LocalScript42,function()
- local MOUSE_ICON = 'rbxassetid://120192974' local Tool = script.Parent
- local Mouse = nil local function UpdateIcon()
- if Mouse then Mouse.Icon = Tool.Enabled and MOUSE_ICON end end local function OnEquipped(mouse) Mouse = mouse UpdateIcon() end local function OnChanged(property)
- if property == 'Enabled' then UpdateIcon() end end Tool.Equipped:connect(OnEquipped) Tool.Changed:connect(OnChanged)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Add Comment
Please, Sign In to add comment