Whatever I do trying to take damage from the health of the humanoid it just won’t work. I’ve tried -= and :TakeDamge() and none of those have worked. Can someone please help me with this?
local Remote = script.Parent.Fire
Remote.OnServerEvent:Connect(function(player, MousePos)
local Bullet = Instance.new("Part")
Bullet.Parent = workspace
Bullet.CanCollide = false
Bullet.Anchored = false
Bullet.Material = Enum.Material.Neon
Bullet.BrickColor = BrickColor.new("Cyan")
Bullet.Shape = Enum.PartType.Ball
Bullet.Size = Vector3.new(1.25,1.25,1.25)
Bullet.CFrame = script.Parent.Handle.BallPosition.CFrame
local NewForce = Instance.new("BodyForce")
NewForce.Force = Vector3.new(0,workspace.Gravity * Bullet:GetMass(),0)
NewForce.Parent = Bullet
Bullet.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position, MousePos).LookVector * 150
local Debounce = true
Bullet.Touched:Connect(function(hit)
local boss = hit.Parent
if boss.Name == "rytansaltheboss" and Debounce then
print("yes")
Debounce = false
local effect = Instance.new("Part")
effect.Parent = workspace
effect.Position = Bullet.Position
effect.Anchored = true
effect.CanCollide = false
effect.Size = Vector3.new(1,1,1)
effect.Material = Enum.Material.Neon
effect.BrickColor = BrickColor.White()
effect.Shape = Enum.PartType.Ball
effect.CastShadow = false
game:GetService("TweenService"):Create(effect,TweenInfo.new(0.5),{
Transparency = 1,
Size = Vector3.new(10,10,10)
}):Play()
local hum = boss:FindFirstAncestorWhichIsA("Humanoid")
hum:TakeDamage(math.random(20,30))
print("yessed")
Bullet.Transparency = 1
task.wait(0.5)
effect:Destroy()
Bullet:Destroy()
end
end)
spawn(function()
task.wait(10)
if Bullet then
Bullet:Destroy()
end
end)
end)