Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- script
- -- variables
- local tool = script.Parent
- local the
- local f = false
- local playing = false
- local tween = game:GetService("TweenService")
- local debris = game:GetService("Debris")
- local tookdmg = false
- local root
- -- some important functions
- function Raycast(position, direction, range, ignore) -- raycast
- local raycastParams = RaycastParams.new()
- raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
- raycastParams.FilterDescendantsInstances = {ignore}
- raycastParams.IgnoreWater = false
- return workspace:Raycast(position, direction.unit * range, raycastParams)
- end
- function ProperRaycast(StartPos, EndPos, Distance, Ignore) -- a proper raycast for the raycast (casting it properly)
- local direction = CFrame.new(StartPos,EndPos).lookVector
- return Raycast(StartPos, direction, Distance, Ignore)
- end
- function createSound(parent,asset,volume,looped,name) -- creating a sound (audio efx)
- local sound = Instance.new("Sound",parent)
- sound.Name = name or "created sound effect"
- sound.Looped = looped
- sound.SoundId = asset
- sound.Volume = volume
- sound:Play()
- debris:AddItem(sound,sound.TimeLength)
- end
- -- main functions
- script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr,mouse) -- this will trigger when the remote event gets fired
- if root ~= nil then
- if f then
- local ray = ProperRaycast(root.Position,mouse.p,6,root.Parent) -- the '6' is the range
- if ray then
- local hit = ray.Instance
- local hum = hit.Parent:FindFirstChildOfClass("Humanoid") -- finding the humanoid within the range
- if hum and tookdmg == false then
- tookdmg = true -- debounce
- hum:TakeDamage(1) -- taking damage
- createSound(hum.Parent:WaitForChild("HumanoidRootPart"),"rbxassetid://1720389178",math.random(0.1,1),false,"punch fx") -- the audio effect
- task.wait(0.1);tookdmg = false -- debounce
- end
- end
- end
- end
- end)
- tool.Activated:Connect(function() --- this gets triggered when you click the tool while equipped
- if f == false then -- check if you are already attacking
- local char = tool.Parent -- get the character of the player using the tool (YOU)
- char.HumanoidRootPart.Anchored = true -- anchor the humanoid
- local anim_start = script.Start -- get the animation
- createSound(root,"rbxassetid://565208983",1,false,"rage fx")
- char.Humanoid.Animator:LoadAnimation(anim_start):Play();task.wait(0.5)
- f = true
- char["Left Arm"].Transparency = 1;char["Right Arm"].Transparency = 1
- root = char.HumanoidRootPart
- local ting = game:GetService("ServerStorage").InvisHands:Clone() -- get the fake arms from the server storage
- the = ting
- ting.AnimSaves:Destroy()
- ting.Parent = char
- for i,v in next, ting:GetChildren() do -- get the hands then recolor them
- if v:IsA("Part") then
- if v.Name == "L1" or v.Name == "L2" then
- v.Color = char["Right Arm"].Color
- elseif v.Name == "R1" or v.Name == "R2" then
- v.Color = char["Left Arm"].Color
- end
- end
- end
- local weld = Instance.new("Motor6D",ting.Main) -- lock the barrage hands to the players root part
- weld.Part0 = weld.Parent
- weld.Part1 = char.HumanoidRootPart
- char.HumanoidRootPart.Anchored = false -- unanchor the player
- local anim = script.Animation
- ting.AnimationController.Animator:LoadAnimation(anim):Play() -- finally, play the barrage animation
- end
- end)
- tool.Deactivated:Connect(function() -- gets triggered when you deactivate the tool
- if the ~= nil and f then -- check if you are attacking
- f = false -- debounce
- local char = tool.Parent -- your character
- for i,v in next, the:GetChildren() do -- get the stuff in your character
- if v:IsA("Part") then -- check if its a part
- local c = {};c.Transparency = 1 -- tween and stuff
- tween:Create(v,TweenInfo.new(0.5),c):Play() -- play the tween
- if v:FindFirstChildOfClass("Trail") then -- get the trail from the fake arms
- v.Trail.Enabled = false -- disable the trail
- end
- end
- end
- char["Left Arm"].Transparency = 0;char["Right Arm"].Transparency = 0 -- reshow the arms
- local anim_start = script.Start -- again, the start animation
- char.Humanoid.Animator:LoadAnimation(anim_start):Play();task.wait(0.5) -- play the animation
- for i,v in next, char:GetChildren() do
- if v.Name == the.Name then
- v:Destroy();the:Destroy() -- destroy the barrage arms
- end
- end
- end
- end)
- spawn(function()
- while task.wait() do
- if f then
- createSound(root,"rbxassetid://711753382",1,false,"punch fx");task.wait(0.1) -- the sound that plays while you are punching + debounce
- end
- end
- end)
- -- made by eric/Er_1x/ERIC#2073 have fun
Add Comment
Please, Sign In to add comment