Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local killEvent = replicatedStorage:WaitForChild("KillEvent")
- local players = game:GetService("Players")
- local player = players.LocalPlayer
- local tool = script.Parent
- local handle = tool:WaitForChild("Handle")
- local toolSounds = tool:WaitForChild("Sounds")
- local equipSound = toolSounds:WaitForChild("Equip")
- local slashSound = toolSounds:WaitForChild("Slash")
- local killSound = toolSounds:WaitForChild("Kill")
- local animations = tool:WaitForChild("Animations")
- local knifeHoldAnimation = animations:WaitForChild("KnifeHold")
- local debounce = false
- tool.Equipped:Connect(function(Cursor) equipSound:Play()
- Cursor.Icon = "rbxasset://textures/GunCursor.png"
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local knifehold = humanoid:LoadAnimation(knifeHoldAnimation); knifeHold:Play()
- tool.Activated:Connect(function()
- if (debounce) then return end; debounce = true
- local randomAnimation = Random.new(tick):NextInteger(1,3)
- local slashAnimation = animations["Slash"..randomAnimation]
- local slash = humanoid:LoadAnimation(slashAnimation); slash:Play()
- slashsound:Play()
- debounce = false
- end
- end)
- end)
- handle.Touched:Connect(function(hit)
- if (hit.Parent == player.Character) then return end
- local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
- if (humanoid) then
- if (humanoid:GetState ~= Enum.HumanoidStateType.Dead) then
- killEvent:FireServer(hit.Parent)
- killSound:Play()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement