Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- wait()
- local Player = game.Players.LocalPlayer
- repeat
- wait()
- until Player.Character
- local Character = Player.Character
- repeat
- wait()
- until Player.Character.Humanoid
- local Humanoid = Player.Character.Humanoid
- local Tool = script.Parent
- local Mouse = Player:GetMouse()
- local Camera = workspace.CurrentCamera
- local UserInputService = game:GetService("UserInputService")
- local reticleOn = game.ReplicatedStorage.ReticleOn.Value
- game.ReplicatedStorage.ReticleOn.Changed:connect(function()
- reticleOn = game.ReplicatedStorage.ReticleOn.Value
- end)
- local plrId = Player.userId
- local canThrow = true
- local dualWeilding = false
- local killpassword = 123
- game.ReplicatedStorage.Remotes.Authenticator.OnClientEvent:connect(function(pw)
- killpassword = pw
- end)
- game.ReplicatedStorage.Remotes.Authenticator:FireServer()
- Mouse.TargetFilter = Camera
- local ToolEquipped = false
- local AnimationBusy = false
- local ANIM_SPEED = 1.5
- local THROW_LENGTH = 0.35
- local THROW_DELAY = 0.35
- local ANIMATIONS = {
- DownStab = Humanoid:LoadAnimation(Tool.DownStab),
- StabPunch = Humanoid:LoadAnimation(Tool.StabPunch),
- ThrowCharge = Humanoid:LoadAnimation(Tool.ThrowCharge),
- Throw = Humanoid:LoadAnimation(Tool.Throw),
- DualEquip = Humanoid:LoadAnimation(Tool.DualEquip)
- }
- local throwing = false
- local DamageEnabled = true
- local canKill = false
- script.Parent.Handle.Touched:connect(function(h)
- if AnimationBusy and canKill and DamageEnabled and h.Parent ~= Character and h.Parent:FindFirstChild("Humanoid") and Tool.Handle.KnifeDecorationHandle.Transparency < 1 then
- DamageEnabled = false
- coroutine.wrap(function()
- Player.PlayerScripts.localknifehandler.HitCheck:Fire(h.Parent)
- end)()
- wait(0.7)
- DamageEnabled = true
- end
- end)
- local function stab()
- if not AnimationBusy and Tool.Parent == Player.Character and Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 then
- AnimationBusy = true
- local startTime2 = tick()
- Tool.Handle.Swoosh.Pitch = math.random(1100, 1300) / 1000
- Tool.Handle.Swoosh:Play()
- canKill = true
- coroutine.wrap(function()
- wait(0.3)
- canKill = false
- end)()
- if math.random(3) == 1 then
- do
- local initGrip = Tool.Grip
- coroutine.wrap(function()
- Tool.Grip = initGrip * CFrame.Angles(math.pi, 0, 0)
- wait(0.6)
- Tool.Grip = initGrip
- end)()
- ANIMATIONS.DownStab:Play(0.1, 1, ANIM_SPEED)
- end
- else
- ANIMATIONS.StabPunch:Play(0.1, 1, ANIM_SPEED)
- end
- repeat
- wait()
- until startTime2 + 0.68 <= tick()
- AnimationBusy = false
- end
- end
- local canUpdate = true
- dualWeilding = game.ReplicatedStorage.Remotes.IsDual:InvokeServer()
- if dualWeilding then
- end
- local effectTransparency = Tool.Handle.KnifeDecorationHandle.Transparency
- local wielded = false
- Tool.Equipped:connect(function()
- if dualWeilding then
- ANIMATIONS.DualEquip:Play()
- end
- Mouse.Icon = "rbxasset://textures\\GunCursor.png"
- ToolEquipped = true
- Tool.Handle.Swoosh:Stop()
- spawn(function()
- if dualWeilding and not wielded then
- wielded = true
- repeat
- wait()
- until Character:FindFirstChild("Knife")
- game.ReplicatedStorage.Remotes.ApplyDual:FireServer(Tool.Handle)
- end
- end)
- Tool.Handle.KnifeDecorationHandle.Transparency = effectTransparency
- game.ReplicatedStorage.Remotes.SheathKnife:FireServer("off")
- end)
- Tool.Unequipped:connect(function()
- canUpdate = true
- pcall(function()
- Mouse.Icon = ""
- ToolEquipped = false
- if Character:FindFirstChild("DecKnife") then
- end
- game.ReplicatedStorage.Remotes.SheathKnife:FireServer("on")
- end)
- ANIMATIONS.DualEquip:Stop()
- end)
- local validMouseHit
- local middleX = Camera.ViewportSize.X * 0.5
- local middleY = Camera.ViewportSize.Y * 0.4
- local mouseDown = false
- if not UserInputService.TouchEnabled then
- UserInputService.InputBegan:connect(function(input, gameProcessed)
- if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.KeyCode == Enum.KeyCode.ButtonR2) and not gameProcessed then
- mouseDown = true
- if ToolEquipped then
- mouseDown = true
- local startTime = tick()
- if not AnimationBusy and Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 then
- ANIMATIONS.ThrowCharge:Play(0.1, 1, 2)
- repeat
- wait()
- until startTime + THROW_LENGTH <= tick() or not mouseDown
- ANIMATIONS.ThrowCharge:Stop()
- if not mouseDown and Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 then
- stab()
- elseif Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 and startTime + THROW_DELAY <= tick() and canThrow then
- canThrow = false
- local ray = Camera:ViewportPointToRay(Mouse.X, Mouse.Y, 1000)
- local char, mapIgnore
- local knifeHost = workspace.KnifeHost
- local ragdollHost = workspace.Ragdolls
- local petHost = workspace.Pets
- if Player.Character then
- char = Player.Character
- end
- if game.Workspace:FindFirstChild("GameMap") and game.Workspace.GameMap:FindFirstChild("IGNORE") then
- mapIgnore = game.Workspace.GameMap.IGNORE
- else
- mapIgnore = workspace.KnifeHost
- end
- game.ReplicatedStorage.Remotes.ThrowKnife:FireServer(Humanoid.TargetPoint, effectTransparency, Tool.RotateValue.Value)
- Tool.Handle.Swoosh.Pitch = math.random(1100, 1300) / 1000
- Tool.Handle.Swoosh:Play()
- ANIMATIONS.Throw:Play(0.1, 1, 3)
- throwing = true
- coroutine.wrap(function()
- wait(1.2)
- canThrow = true
- end)()
- wait(1)
- throwing = false
- Tool.Handle.KnifeDecorationHandle.Transparency = effectTransparency
- end
- end
- end
- end
- end)
- UserInputService.InputEnded:connect(function(input, gameProcessed)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.KeyCode == Enum.KeyCode.ButtonR2 then
- mouseDown = false
- end
- end)
- else
- UserInputService.InputBegan:connect(function(input, gameProcessed)
- if input.UserInputType == Enum.UserInputType.Touch and not gameProcessed then
- mouseDown = true
- wait(0.05)
- if input.Delta.Magnitude < 1 and mouseDown and ToolEquipped then
- mouseDown = true
- local startTime = tick()
- if not AnimationBusy and Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 then
- ANIMATIONS.ThrowCharge:Play(0.1, 1, 2)
- repeat
- wait()
- until startTime + THROW_LENGTH <= tick() or not mouseDown
- ANIMATIONS.ThrowCharge:Stop()
- if not mouseDown and Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 then
- stab()
- elseif Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 and startTime + THROW_DELAY <= tick() and canThrow then
- canThrow = false
- if reticleOn then
- local RayMag1 = Camera:ViewportPointToRay(middleX, middleY)
- local NewRay = Ray.new(RayMag1.Origin, RayMag1.Direction * 1000)
- local Target, hit = workspace:FindPartOnRay(NewRay, Player.Character)
- game.ReplicatedStorage.Remotes.ThrowKnife:FireServer(hit, effectTransparency, Tool.RotateValue.Value)
- else
- local ray = Camera:ViewportPointToRay(input.Position.x, input.Position.y, 1000)
- local ignore = game.Workspace.KnifeHost
- if game.Workspace:FindFirstChild("Map") then
- ignore = game.Workspace.Map:FindFirstChild("IGNORE")
- end
- local part, hit = game.Workspace:FindPartOnRayWithIgnoreList(ray, {
- Player.Character
- })
- game.ReplicatedStorage.Remotes.ThrowKnife:FireServer(hit, effectTransparency, Tool.RotateValue.Value)
- end
- Tool.Handle.Swoosh.Pitch = math.random(1100, 1300) / 1000
- Tool.Handle.Swoosh:Play()
- ANIMATIONS.Throw:Play(0.1, 1, 3)
- throwing = true
- coroutine.wrap(function()
- wait(1.2)
- canThrow = true
- end)()
- wait(1)
- Tool.Handle.KnifeDecorationHandle.Transparency = effectTransparency
- throwing = false
- end
- end
- end
- end
- end)
- UserInputService.InputBegan:connect(function(input, gameProcessed)
- if input.UserInputType == Enum.UserInputType.MouseButton1 and not gameProcessed then
- print("mouse hit on touch enabled")
- mouseDown = true
- if ToolEquipped then
- mouseDown = true
- local startTime = tick()
- if not AnimationBusy and Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 then
- ANIMATIONS.ThrowCharge:Play(0.1, 1, 2)
- repeat
- wait()
- until startTime + THROW_LENGTH <= tick() or not mouseDown
- ANIMATIONS.ThrowCharge:Stop()
- if not mouseDown and Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 then
- stab()
- elseif Tool.Handle.KnifeDecorationHandle.Transparency < 0.6 and startTime + THROW_DELAY <= tick() and canThrow then
- canThrow = false
- local ray = Camera:ViewportPointToRay(Mouse.X, Mouse.Y, 1000)
- local char, mapIgnore
- local knifeHost = workspace.KnifeHost
- local ragdollHost = workspace.Ragdolls
- local petHost = workspace.Pets
- if Player.Character then
- char = Player.Character
- end
- if game.Workspace:FindFirstChild("GameMap") and game.Workspace.GameMap:FindFirstChild("IGNORE") then
- mapIgnore = game.Workspace.GameMap.IGNORE
- else
- mapIgnore = workspace.KnifeHost
- end
- game.ReplicatedStorage.Remotes.ThrowKnife:FireServer(Humanoid.TargetPoint, effectTransparency, Tool.RotateValue.Value)
- Tool.Handle.Swoosh.Pitch = math.random(1100, 1300) / 1000
- Tool.Handle.Swoosh:Play()
- ANIMATIONS.Throw:Play(0.1, 1, 3)
- throwing = true
- coroutine.wrap(function()
- wait(1.2)
- canThrow = true
- end)()
- wait(1)
- throwing = false
- Tool.Handle.KnifeDecorationHandle.Transparency = effectTransparency
- end
- end
- end
- end
- end)
- UserInputService.InputEnded:connect(function(input, gameProcessed)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- mouseDown = false
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement