Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Solved] Why is my Instance failing to do damage to other players?

Asked by 5 years ago
Edited 5 years ago

I've been trying to make my attack for a while now but I can't get past this issue. No matter what I do it just refuses to damage the players.

LocalScript in StarterPlayerScripts

--Finds Player--
local UserInputService =    game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local deb = false
local RemoteEvent = game.Workspace.Remote:FindFirstChild("Tackled")


--Finds Animations--
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://2867339187"
local AnimationR = Instance.new("Animation")
AnimationR.AnimationId = "rbxassetid://2867339668"
local AnimationL = Instance.new("Animation")
AnimationL.AnimationId = "rbxassetid://2867395453"
local Animations = {AnimationL,AnimationR}
local track = Humanoid:LoadAnimation(Animation)

--Just finding the Particles--
local particle = Character:WaitForChild("LeftUpperArm"):WaitForChild("ParticleEmitter")
local particle1 = Character:WaitForChild("RightLowerArm"):WaitForChild("ParticleEmitter")
local particle2 = Character:WaitForChild("RightUpperLeg"):WaitForChild("ParticleEmitter")
local particle3 = Character:WaitForChild("UpperTorso"):WaitForChild("ParticleEmitter")
local particle4 = Character:WaitForChild("LowerTorso"):WaitForChild("ParticleEmitter")



--Funtion That Starts Animation and Enables the Particles--
UserInputService.InputBegan:Connect(function(input, proc)
  local track2 = Humanoid:LoadAnimation(Animations[math.random(#Animations)])
    if not proc and input.KeyCode == Enum.KeyCode.T then
      if deb == true then return end
         deb = true
         RemoteEvent:FireServer()
         particle.Enabled = true
         particle1.Enabled = true
         particle2.Enabled = true
         particle3.Enabled = true
         particle4.Enabled = true
         track:Play()
         wait(0.35)
         track:Stop()
         track2:Play() --Animaton Follows--
         wait(0.45)
         track2:Stop()
         particle.Enabled = false
         particle1.Enabled = false
         particle2.Enabled = false
         particle3.Enabled = false
         particle4.Enabled = false
         deb = false
     end
end)

Script in Workspace

game.Workspace.Remote:FindFirstChild("Tackled").OnServerEvent:Connect(function(Player, Debounce)
  local AlreadyTouched = false
  local Character = Player.Character or Player.CharacterAdded:Wait()
  Debounce = true
  local Blast = Instance.new("Part")
  Blast.Name = "Blast"
  Blast.Shape = Enum.PartType.Ball
  Blast.Size = Vector3.new(2,2,2)
  Blast.Material = Enum.Material.Neon
  Blast.BrickColor = BrickColor.new("Toothpaste")
  Blast.CanCollide = false
  Blast.Parent = game.Workspace
  Blast.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(0,1,-6)
  local BV = Instance.new("BodyVelocity")
  BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector*100
  BV.Parent = Blast
  Blast.Touched:Connect(function(Hit)
    local Humanoid = Hit.Parent:FindFirsthChild("Humanoid")
    if Humanoid == nil then return end
       if AlreadyTouched == false then
       AlreadyTouched = true
       if Humanoid.Parent == Character then
         Humanoid.Health = Humanoid.Health - 0
       else
         Humanoid.Health = Humanoid.Health - Humanoid.MaxHealth/4
         end
       end
    end)
    wait(2)
    Debounce = false
end)
0
these are some tanky scripts xd starmaq 1290 — 5y
0
Bump songboy50 77 — 5y
0
Lol I had a typo in "FindFirstChild" my bad it works now :D songboy50 77 — 5y

Answer this question