Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent.Event.OnServerEvent:Connect(function(client)
- script.Parent.Name = "GrabKnife"
- local selected = false
- local attacking = false
- local hurt = false
- local grabbed = nil
- local char = script.Parent.Parent
- local mode = "drop"
- script.Parent.KeyQ.OnServerEvent:Connect(function(client)
- mode = "drop"
- end)
- script.Parent.KeyE.OnServerEvent:Connect(function(client)
- mode = "throw"
- end)
- script.Parent.KeyF.OnServerEvent:Connect(function(client)
- mode = "kill"
- end)
- function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
- part.Parent = parent
- part.formFactor = form
- part.CanCollide = collide
- part.Transparency = tran
- part.Reflectance = ref
- part.Size = Vector3.new(x,y,z)
- part.BrickColor = BrickColor.new(color)
- part.TopSurface = 0
- part.BottomSurface = 0
- part.Anchored = anchor
- part.Locked = true
- part:BreakJoints()
- end
- function weld(w, p, p1, a, b, c, x, y, z)
- w.Parent = p
- w.Part0 = p
- w.Part1 = p1
- w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
- end
- function mesh(mesh, parent, x, y, z, type)
- mesh.Parent = parent
- mesh.Scale = Vector3.new(x, y, z)
- mesh.MeshType = type
- end
- if char:findFirstChild("Bricks",true) then
- char:findFirstChild("Bricks",true):remove()
- end
- local bricks = Instance.new("Model",char)
- bricks.Name = "Bricks"
- --Parts-------------------------Parts-------------------------Parts-------------------------Parts----------------------
- local rarm = char:findFirstChild("Right Arm")
- local larm = char:findFirstChild("Left Arm")
- local lleg = char:findFirstChild("Left Leg")
- local torso = char:findFirstChild("Torso")
- local hum = char:FindFirstChildWhichIsA("Humanoid")
- local righthold = Instance.new("Part")
- prop(righthold, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
- local w11 = Instance.new("Weld")
- weld(w11, rarm, righthold, 0, 0, 0, 0, 1, 0)
- local lefthold = Instance.new("Part")
- prop(lefthold, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
- local w12 = Instance.new("Weld")
- weld(w12, larm, lefthold, 0, 0, 0, 0, 1, 0)
- local hold = Instance.new("Part")
- prop(hold, bricks, false, 0, 0, 0.2, 0.4, 0.7, "Really red", false, "Custom")
- local oh = Instance.new("Weld")
- weld(oh, lleg, hold, -math.pi/1.4, 0, math.rad(35), 0.55, -0.9, 0.3)
- local knife = Instance.new("Part")
- prop(knife, bricks, false, 0, 0, 0.35, 1.1, 0.5, "Really black", false, "Custom")
- local orr = Instance.new("Weld")
- weld(orr, hold, knife, 0, 0, 0, 0, 0.7, 0)
- local ar = Instance.new("Weld")
- weld(ar, lefthold, nil, math.pi/2, 0, math.pi, 0, 0, 0)
- local blade = Instance.new("Part")
- prop(blade, bricks, false, 0, 0, 0.1, 1.5, 0.4, "Medium grey", false, "Custom")
- Instance.new("BlockMesh",blade).Scale = Vector3.new(0.3,1,1)
- local w2 = Instance.new("Weld")
- weld(w2, knife, blade, 0, 0, 0, 0, -1.2, 0)
- local blade2 = Instance.new("Part")
- prop(blade2, bricks, false, 0, 0, 0.1, 0.5, 0.4, "Medium grey", false, "Custom")
- local mew = Instance.new("SpecialMesh",blade2)
- mew.MeshType = "Wedge"
- mew.Scale = Vector3.new(0.3,1,1)
- local w3 = Instance.new("Weld")
- weld(w3, blade, blade2, 0, 0, 0, 0, -1, 0)
- local rb = Instance.new("Part")
- prop(rb, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
- local w13 = Instance.new("Weld")
- weld(w13, torso, rb, 0, 0, 0, -1.5, -0.5, 0)
- local lb = Instance.new("Part")
- prop(lb, bricks, false, 1, 0, 0.1, 0.1, 0.1, "White", false, "Custom")
- local w14 = Instance.new("Weld")
- weld(w14, torso, lb, 0, 0, 0, 1.5, -0.5, 0)
- local rw = Instance.new("Weld")
- weld(rw, rb, nil, 0, 0, 0, 0, 0.5, 0)
- local lw = Instance.new("Weld")
- weld(lw, lb, nil, 0, 0, 0, 0, 0.5, 0)
- local grabweld = nil
- local platlol = nil
- local lolhum = nil
- function touch(h)
- if hurt then
- if grabbed == nil then
- local hu = h.Parent:findFirstChildWhichIsA("Humanoid")
- local head = h.Parent:findFirstChild("Head")
- local torz = h.Parent:findFirstChild("Torso")
- if hu ~= nil and head ~= nil and torz ~= nil then
- if hu.Health > 0 then
- grabbed = torz
- hu.PlatformStand = true
- local w = Instance.new("Weld")
- weld(w,righthold,grabbed,math.pi/2,0.2,0,0.7,-0.9,-0.6)
- grabweld = w
- lolhum = hu
- local lolxd = true
- platlol = lolxd
- hu.Changed:connect(function(prop)
- if prop == "PlatformStand" and platlol then
- hu.PlatformStand = true
- end
- end)
- end
- end
- end
- end
- end
- righthold.Touched:connect(touch)
- lefthold.Touched:connect(touch)
- script.Parent.Click.OnServerEvent:Connect(function(client)
- orr.Part1 = nil
- ar.Part1 = knife
- if attacking == false then
- attacking = true
- lw.Part1 = larm
- rw.Part1 = rarm
- hurt = true
- for i=1, 8 do
- rw.C0 = rw.C0 * CFrame.new(-0.03,0,-0.08) * CFrame.fromEulerAnglesXYZ(0.18,0.04,0)
- lw.C0 = lw.C0 * CFrame.new(0.06,0,-0.06) * CFrame.fromEulerAnglesXYZ(0.15,-0.11,-0.05)
- wait(0.1)
- end
- wait(1)
- hurt = false
- if grabbed == nil then
- for i=1, 4 do
- rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
- lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.12) * CFrame.fromEulerAnglesXYZ(-0.3,0.22,0.05)
- wait(0.1)
- end
- lw.C0 = CFrame.new(0,0,0)
- rw.C0 = CFrame.new(0,0,0)
- lw.Part1 = nil
- rw.Part1 = nil
- attacking = false
- end
- elseif hurt == false and grabbed ~= nil and mode == "drop" then
- grabweld:remove()
- grabweld = nil
- platlol = false
- grabbed = nil
- lolhum.PlatformStand = false
- lolhum = nil
- for i=1, 4 do
- rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
- lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.3,0.2,0)
- wait(0.1)
- end
- lw.C0 = CFrame.new(0,0,0)
- rw.C0 = CFrame.new(0,0,0)
- lw.Part1 = nil
- rw.Part1 = nil
- attacking = false
- platlol = nil
- elseif hurt == false and grabbed ~= nil and grabweld ~= nil and mode == "throw" then
- grabweld:remove()
- grabweld = nil
- local bf = Instance.new("BodyForce",grabbed)
- bf.force = torso.CFrame.lookVector * 8500
- bf.force = bf.force + Vector3.new(0,7400,0)
- coroutine.resume(coroutine.create(function()
- wait(0.12)
- bf:remove()
- end))
- for i=1, 6 do
- rw.C0 = rw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0.35,0,0)
- lw.C0 = lw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(-0.18,0,0)
- wait(0.1)
- end
- for i=1, 4 do
- rw.C0 = rw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(-0.47,0,0)
- lw.C0 = lw.C0 * CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0.2,0,0)
- wait(0.1)
- end
- wait(0.2)
- platlol = false
- grabbed = nil
- lolhum.PlatformStand = false
- lolhum = nil
- for i=1, 4 do
- rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
- lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.3,0.2,0)
- wait(0.1)
- end
- lw.C0 = CFrame.new(0,0,0)
- rw.C0 = CFrame.new(0,0,0)
- lw.Part1 = nil
- rw.Part1 = nil
- attacking = false
- platlol = nil
- elseif hurt == false and grabbed ~= nil and lolhum ~= nil and grabweld ~= nil and mode == "kill" then
- for i=1, 5 do
- lw.C0 = lw.C0 * CFrame.new(0.02,0.12,0.1) * CFrame.fromEulerAnglesXYZ(-0.05,0,-0.03)
- wait(0.1)
- end
- local ne = grabbed:findFirstChild("Neck")
- coroutine.resume(coroutine.create(function()
- local duh = grabbed
- local duh2 = grabbed.Parent.Head
- local lolas = lolhum
- duh.RotVelocity = Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20))
- for i=1, 60 do
- wait(0.1)
- local hm = math.random(1,9)
- pcall(function()
- if hm == 1 then
- local Sound = Instance.new("Sound", duh2)
- Sound.SoundId = "rbxassetid://4792539171"
- duh2.Sound.Pitch = math.random(90,110)/100
- duh2.Sound:play()
- end
- end)
- if hm > 0 and hm < 3 then
- end
- end
- lolas.Health = 0
- for i=1, 85 do
- wait(0.1)
- local hm = math.random(1,9)
- pcall(function()
- if hm == 1 then
- duh2.Sound.Pitch = math.random(90,110)/100
- duh2.Sound:play()
- end
- end)
- if hm > 0 and hm < 3 then
- end
- end
- end))
- for i=1, 3 do
- lw.C0 = lw.C0 * CFrame.new(0.02,0.12,0.1) * CFrame.fromEulerAnglesXYZ(-0.05,0,-0.03)
- if ne ~= nil then
- grabbed.Neck.C0 = grabbed.Neck.C0 * CFrame.fromEulerAnglesXYZ(-0.35,0,0)
- end
- wait(0.1)
- end
- grabweld:remove()
- grabweld = nil
- for i=1, 4 do
- lw.C0 = lw.C0 * CFrame.new(-0.04,-0.24,-0.2) * CFrame.fromEulerAnglesXYZ(0.1,0,0.06)
- wait(0.1)
- end
- for i=1, 4 do
- rw.C0 = rw.C0 * CFrame.new(0.06,0,0.16) * CFrame.fromEulerAnglesXYZ(-0.36,-0.08,0)
- lw.C0 = lw.C0 * CFrame.new(-0.12,0,0.12) * CFrame.fromEulerAnglesXYZ(-0.3,0.22,0.05)
- wait(0.1)
- end
- lw.C0 = CFrame.new(0,0,0)
- rw.C0 = CFrame.new(0,0,0)
- lw.Part1 = nil
- rw.Part1 = nil
- platlol = false
- grabbed = nil
- lolhum = nil
- attacking = false
- platlol = nil
- end
- script.Parent.Unequip.OnServerEvent:Connect(function(client)
- repeat wait(0.1) until attacking == false
- orr.Part1 = knife
- ar.Part1 = nil
- script.Parent.Died.OnServerEvent:Connect(function(client)
- pcall(function()
- grabweld:remove()
- grabweld = nil
- grabbed = nil
- platlol = false
- platlol = nil
- end)
- end)
- end)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement