Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool = script.Parent
- local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
- local humanoid = char.Humanoid
- local stabAnim = humanoid:WaitForChild("Animator"):LoadAnimation(script:WaitForChild("StabAnimation"))
- local throwAnim = humanoid:WaitForChild("Animator"):LoadAnimation(script:WaitForChild("ThrowAnimation"))
- local cam = workspace.CurrentCamera
- local mouse = game.Players.LocalPlayer:GetMouse()
- local rs = game.ReplicatedStorage:WaitForChild("MurderMysteryReplicatedStorage")
- local config = require(rs:WaitForChild("CONFIGURATION"))
- local re = rs:WaitForChild("RemoteEvent")
- local equipped = false
- local onCooldown = false
- local buttonPressed = nil
- tool.Equipped:Connect(function()
- equipped = true
- end)
- tool.Unequipped:Connect(function()
- equipped = false
- end)
- mouse.Button1Down:Connect(function()
- mouse.TargetFilter = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
- if not onCooldown and equipped then
- buttonPressed = tick()
- end
- end)
- mouse.Button1Up:Connect(function()
- if not onCooldown and equipped and buttonPressed then
- onCooldown = true
- if tick() - buttonPressed < config.MurdererWeaponHoldToThrowDuration then
- re:FireServer("MURDERER STAB", tool)
- stabAnim:Play()
- elseif buttonPressed and tick() - buttonPressed >= config.MurdererWeaponHoldToThrowDuration then
- re:FireServer("MURDERER THROW", tool, cam.CFrame, mouse.Hit)
- throwAnim:Play()
- end
- buttonPressed = nil
- task.wait(config.MurdererWeaponCooldown)
- onCooldown = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement