Cloned Part doesn't deal damage

  1. Trying to make a cloned part deal damage. It won’t.

  2. A part that I’m cloning will not deal any damage to players.

  3. Looking through devforums and youtube videos, none of which have worked.

scripts:

  1. local script in a folder, in starter pack
  2. a script within a remote event that was in the previous local script
  3. a damage script inside of a hitbox part, inside of the effect part
wait(1)

local UIS = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Remote = script.RemoteEvent

local Key = "T"
local Cooldown = true

UIS.InputBegan:Connect(function(Input, IsTyping)
	if IsTyping then return end
	local KeyPressed = Input.KeyCode
	if KeyPressed == Enum.KeyCode[Key] and Character and Cooldown == true then
		Cooldown = false
		
		Remote:FireServer("Explode")
		
		wait(.5) -- cooldown length
		
		Cooldown = true
		
	end
end)
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local Remote = script.Parent

Remote.OnServerEvent:Connect(function(player, Skill)
	local Character = player.Character
	local RootPart = Character.HumanoidRootPart
	local TweenService = game:GetService("TweenService")
	
	if Skill == "Explode" then
		local Track = Instance.new("Animation")
		Track.AnimationId = "rbxassetid://15160791344"
		local Anim = Character.Humanoid:LoadAnimation(Track)
		Anim:Play()
		
		local Effect = ReplicatedStorage.Effects.ExplosionFx:Clone()
		Effect.CFrame = RootPart.CFrame + RootPart.CFrame.LookVector * 50
		Effect.Orientation = RootPart.Orientation
		Effect.Parent = workspace.FX
		game.Debris:AddItem(Effect, 3)
		
		local Sound = ReplicatedStorage.Sounds.Pew:Clone()
		Sound.Parent = RootPart
		Sound:Play()
		game.Debris:AddItem(Sound, .7)
		
		local Position = Instance.new("BodyVelocity", RootPart)
		Position.MaxForce = Vector3.new(9999999999, 9999999999, 9999999999)
		Position.P = 300
		Position.Velocity = RootPart.CFrame.LookVector * .01 -- how far you move
		game.Debris:AddItem(Position, .5) --how long you stay still for
		
		wait(.4)
		local Sound = ReplicatedStorage.Sounds.Explosion:Clone()
		Sound.Parent = RootPart
		Sound:Play()
		game.Debris:AddItem(Sound, 1.8)
		
		Effect.A.P1:Emit(20)
		Effect.P2:Emit(30)
		wait(.2)
		
		local Position = Instance.new("BodyVelocity", RootPart)
		Position.MaxForce = Vector3.new(9999999999, 9999999999, 9999999999)
		Position.P = 300
		Position.Velocity = RootPart.CFrame.LookVector * -50 -- how far you move
		game.Debris:AddItem(Position, .25) --how long you stay still for
		
		Effect.A.P3:Emit(20)
		Effect.A.P4:Emit(10)
	end
end)
local canHit = true

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if canHit then
			canHit = false
			hit.Parent.Humanoid:TakeDamage(1000)
		end
	end
end)

image

(this is my first post here, sorry if its a bit scuffed)

2 Likes

maybe put like a print(hit.Parent) to see if its actually hitting something