Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Properties = {
- debounce = true, -- Leave this on true.
- sound_fx = true, -- If you don't want sound to play when tool is activated set this to false.
- anim_check = true, -- If you don't want animation to play when tool is activated set this to false.
- ToolDrop = false, -- Set this to true if you want to be able to drop the tool by pressing BackSpace.
- soundID = 6042531284, -- Sound Id.
- AnimID = 6461572129, -- Your Animtion id.
- debounce_lenght = 1, -- how long it will take before you can click again, aka cooldown so you can't spam click the tool.
- soundDelay = 0.25, -- How long to wait before playing sound
- enableTrail = true, -- Enable trail thing
- trail = script.Parent.Head.Trail, -- the trail thing
- damage = 5 -- how much dmg the thing does
- }
- local Tool = script.Parent
- local Handle = Tool:WaitForChild("Handle")
- local BaseUrl = "rbxassetid://"
- local anim = Tool:WaitForChild("Animation")
- local Players = game:GetService("Players")
- if Properties.sound_fx then
- sound = Handle:WaitForChild("Sound")
- sound.SoundId = BaseUrl .. Properties.soundID
- sound.MaxDistance = 100
- sound.RollOffMode = Enum.RollOffMode.InverseTapered
- end
- if Properties.anim_check then
- anim.AnimationId = BaseUrl .. Properties.AnimID
- end
- if Properties.ToolDrop == true then
- Tool.CanBeDropped = true
- end
- Tool.Equipped:Connect(function(Mouse) -- When you equip the tool
- local player = Players:GetPlayerFromCharacter(Tool.Parent) -- gets the player
- if Properties.anim_check == true then animation = player.Character.Humanoid:LoadAnimation(anim)end -- loads animation
- Tool.Activated:Connect(function() -- when you click with the tool
- if Properties.debounce then
- Properties.debounce = false
- if Properties.anim_check == true then animation:Play()end
- if Properties.sound_fx == true then wait(Properties.soundDelay) sound:Play()end
- if Properties.enableTrail == true then
- Properties.trail.Enabled = true
- wait(0.2)
- Properties.trail.Enabled = false
- end
- local debounce = false
- script.Parent.Head.Touched:Connect(function(Hit)
- --print(Hit.Name)
- if Hit:FindFirstChildWhichIsA("NumberValue") and Hit:FindFirstChildWhichIsA("NumberValue").Name == "Health" then
- local temp = Hit:FindFirstChildWhichIsA("NumberValue")
- --print(temp.Name .. ": " .. temp.Value)
- if debounce == false then
- debounce = true
- temp.Value = temp.Value - Properties.damage
- wait(1.2)
- debounce = false
- end
- end
- end)
- wait(Properties.debounce_lenght)
- Properties.debounce = true
- end
- end)
- end)
- Tool.Unequipped:Connect(function()
- if Properties.anim_check == true then animation:Stop()end
- if Properties.sound_fx then sound:Stop()end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement