To Expand, i created a punch tool. When you activate the tool, it fires an animation and does some damage.
Either it's not damaging the dummies, instead it damages me, it's still active, even after i unequip it.
I've been constantly working on this 24/7 and then i found out i could get some help on this site. not only for a good feel, but for future reference.
Local Script:
local Animation = script.Animation
local Replicated = game:GetService("ReplicatedStorage")
local RemoteEvent = Replicated.Remotes.Punch
local Debounce = false
wait(2)
local Humanoid = game.Players.LocalPlayer.Character.Humanoid
script.Parent.Activated:Connect(function()
if not Debounce then
Debounce = true
local AnimationTrack = Humanoid:LoadAnimation(Animation)
RemoteEvent:FireServer()
wait(2)
Debounce = false
end
end)
Server Script:
local Tools = game:GetService("ReplicatedStorage"):WaitForChild("Tools")
local RemoteEvent = game:GetService("ReplicatedStorage").Remotes.Punch
local Animation = Tools.SuperPunch.PunchConnecter.Animation
wait(1)
RemoteEvent.OnServerEvent:Connect(function(player)
local Hum = player.Character.Humanoid
local AnimationTrack = Hum:LoadAnimation(Animation)
AnimationTrack:Play()
if AnimationTrack.IsPlaying then
local LeftArm = player.Character["RightHand"]
LeftArm.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
Hum:TakeDamage(20)
Hum.Sit = true
end
end)
end
end)

2 comments
Local?
no