SOLVED (Script wont do damage)

I am working on a jojo game and my barrage used to do damage but now it isnt, i have tried everythign but still cant figure it out

local event = game:GetService("ReplicatedStorage"):WaitForChild("Stand").WSBarrage -- this is the event which fires from client to server
local TweenService = game:GetService("TweenService") -- this is a very useful function for extra effects
local Debris = game:GetService("Debris")
local Damage = 1.3
script.BarrageSound:Play()

--u can get ur own one im just using a free one as an example
local function Detect(Character)
	local Hitbox = script.Hitbox:Clone()
	Hitbox.Parent = workspace
	Hitbox.CFrame = Character.PrimaryPart.CFrame * CFrame.new(0,0,Hitbox.Size.Z/2 * -1)
	
	local Connection 
	Connection = Hitbox.Touched:Connect(function(hitted)
		if hitted.Parent.Parent:FindFirstChild("Humanoid") and not hitted:IsDescendantOf(Character) then
			local Enemy = hitted.Parent
			Enemy.Humanoid:TakeDamage(Damage)
			Connection:Disconnect()
			script.BarrageSound:Pause()
			script.BarrageSound.TimePosition = 0
			
			local bv = Instance.new("BodyVelocity")
			bv.MaxForce = Vector3.new(1e6,1e6,1e6)
			bv.Velocity = Character.PrimaryPart.CFrame.LookVector * 10
			Debris:AddItem(bv,.2)
			bv.Parent = Enemy.PrimaryPart

			Enemy.Humanoid:LoadAnimation(script.HitAnim):Play()

		end
	end)


	Debris:AddItem(Hitbox,.3)



end

works as intended but doesnt deal damage

Probably because the Damage is set to 1.3

doesnt matter that its set to 1.3, even if it was set to 10 it still doesnt change the humanoids health

i figured out the issue, the script stops whenever it gets to line 14, but the problem is i dont know why this happens

Can I see the video of how it works, It might help.
Also do you have any errors in the output?

Can you paste the entire script?

heres the whole script, i changed the top of the script a little so its doing damage but only to me and not the dummy

local event = game:GetService("ReplicatedStorage"):WaitForChild("Stand").WSBarrage -- this is the event which fires from client to server
local TweenService = game:GetService("TweenService") -- this is a very useful function for extra effects
local Debris = game:GetService("Debris")
local Damage = 1.3
script.BarrageSound:Play()

--u can get ur own one im just using a free one as an example
local function Detect(Character)
	local Hitbox = script.Hitbox:Clone()
	Hitbox.Parent = Character
	Hitbox.CFrame = Character.PrimaryPart.CFrame * CFrame.new(0,0,Hitbox.Size.Z/4 * -4)
	
	local Connection = Hitbox.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("HumanoidRootPart") and hit.Parent ~= Character:GetChildren() then
			print(hit)
			
			local Enemy = hit.Parent
			
			local bv = Instance.new("BodyVelocity")
			bv.MaxForce = Vector3.new(1e6,1e6,1e6)
			bv.Velocity = Character.PrimaryPart.CFrame.LookVector * 10
			Debris:AddItem(bv,.2)
			bv.Parent = Enemy.Parent.PrimaryPart

			Enemy.Humanoid:LoadAnimation(script.HitAnim):Play()
			Enemy.Humanoid:TakeDamage(Damage)

		end
	end)


	Debris:AddItem(Hitbox,.3)



end













local function CreateArm(Character)
	local Stand = game:GetService("ServerStorage").StandModel.WhiteSnake
	local StartXR = math.random(150,350)/100
	Detect(Character)
	local StartXL = math.random(150,350)/100 * -1
	local StartYR = math.random(-150,250)/100
	local StartYL = math.random(-150,250)/100
	local LeftArmModel = Instance.new("Model")
	LeftArmModel.Name = "LeftArm"
	LeftArmModel.Parent = game.Workspace
	Debris:AddItem(LeftArmModel,.3)
	local LLA = Stand:FindFirstChild("LeftLowerArm"):Clone()
	LLA.Parent = LeftArmModel
	local LUA = Stand:FindFirstChild("LeftUpperArm"):Clone()
	LUA.Parent = LeftArmModel
	local LH = Stand:FindFirstChild("LeftHand"):Clone()
	LH.Parent = LeftArmModel
	local weld1 = Instance.new("WeldConstraint")
	weld1.Part0 = LH
	weld1.Part1 = LLA
	weld1.Parent = LH 
	local weld2 = Instance.new("WeldConstraint")
	weld2.Part0 = LUA
	weld2.Part1 = LLA
	weld2.Parent = LUA
	for i ,  v  in pairs(LeftArmModel:GetDescendants()) do
		if v:IsA("Texture") or v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = .2
			TweenService:Create(v,TweenInfo.new(.3),{Transparency = .75}):Play()
		end
		if v:IsA("Motor6D") then
			v:Destroy()
		end
	end
	LeftArmModel.PrimaryPart = LLA
	LeftArmModel.PrimaryPart.Anchored = true

	LeftArmModel.PrimaryPart.CFrame = CFrame.new(Character.PrimaryPart.CFrame * CFrame.new(StartXL,StartYL,-1.5).Position,Character.PrimaryPart.CFrame * CFrame.new(StartXL * .4,StartYL * .4,-8).Position) * CFrame.Angles(math.rad(90),0,0)
	TweenService:Create(LeftArmModel.PrimaryPart,TweenInfo.new(.3),{CFrame = LeftArmModel.PrimaryPart.CFrame * CFrame.new(0,-5,0)}):Play()
	local RightArmModel = Instance.new("Model")
	RightArmModel.Name = "LeftArm"
	RightArmModel.Parent = game.Workspace
	Debris:AddItem(RightArmModel,.3)
	local RLA = Stand:FindFirstChild("RightLowerArm"):Clone()
	RLA.Parent = RightArmModel
	local RUA = Stand:FindFirstChild("RightUpperArm"):Clone()
	RUA.Parent = RightArmModel
	local RH = Stand:FindFirstChild("RightHand"):Clone()
	RH.Parent = RightArmModel
	local weld1 = Instance.new("WeldConstraint")
	weld1.Part0 = RH
	weld1.Part1 = RLA
	weld1.Parent = RH 
	local weld2 = Instance.new("WeldConstraint")
	weld2.Part0 = RUA
	weld2.Part1 = RLA
	weld2.Parent = RUA
	for i ,  v  in pairs(RightArmModel:GetDescendants()) do
		if v:IsA("Texture") or v:IsA("BasePart") or v:IsA("Decal") then
			v.Transparency = .2
			TweenService:Create(v,TweenInfo.new(.3),{Transparency = .75}):Play()
		end
		if v:IsA("Motor6D") then
			v:Destroy()
		end
	end
	RightArmModel.PrimaryPart = RLA
	RightArmModel.PrimaryPart.Anchored = true

	RightArmModel.PrimaryPart.CFrame = CFrame.new(Character.PrimaryPart.CFrame * CFrame.new(StartXR,StartYR,-1.5).Position,Character.PrimaryPart.CFrame * CFrame.new(StartXR * .4,StartYR * .4,-8).Position) * CFrame.Angles(math.rad(90),0,0)
	TweenService:Create(RightArmModel.PrimaryPart,TweenInfo.new(.3),{CFrame = RightArmModel.PrimaryPart.CFrame * CFrame.new(0,-5,0)}):Play()




end



event.OnServerEvent:Connect(function(Player,hold)
	local Character = Player.Character
	local Stand = Character:FindFirstChild("Stand")
	if Stand then
		if not Character:FindFirstChild("Barraging") then

			if hold == true and Character.UsingMove.Value == false then
				local barraging = Instance.new("BoolValue")
				barraging.Name = "Barraging"
				barraging.Parent = Character
				Character.UsingMove.Value = true
				Character.PrimaryPart.StandPosition.Position = Vector3.new(0,0,-2)
				local Anim = Stand.AnimationController:LoadAnimation(script.Anim)
				Anim.Priority= Enum.AnimationPriority.Action
				Anim:Play()
				local Sound = script.BarrageSound:Clone()

				Sound.Parent = Character.PrimaryPart
				Sound:Play()
				local Starttime = tick()
				repeat 
					wait(.15)
					CreateArm(Character)
				until tick() - Starttime >= 5 or not Character:FindFirstChild("Barraging")
				Character.PrimaryPart.StandPosition.Position = Vector3.new(-2.5,1,1)
				Anim:Stop()
				Sound:Destroy()
				Character.UsingMove.Value = false
			end


		else
			Character:FindFirstChild("Barraging"):Destroy()





		end

	end

end)

i figured it out, thanks for your time though

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.