Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My attack script doesn't damage humanoid?

So, I have made a "Attack." It clones a sphere from ServerStorage and makes it grow, hurting anything which touches it but normal players (I have made a R6 Model and named his humanoid BotHumanoid, and then checked if it had BotHumanoid, then makes it take damage, more info in the not working script.)

For some reason it doesn't work, if you can tell me how to fix it, I would be greatful.

bomb.Touched:Connect(function(hit)
		if hit.Parent.Name == "BotHumanoid" then
			local human = hit.Parent.BotHumanoid
			human.Health = human.Health - 10
		end
	end)
--The full script is in the comments, it's pretty long because I don't wanna use a while loop to resize the attack, I have a way to make it smoother, which requires me to do it without a while loop.

1 comment

0

local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage:WaitForChild("BombEvent") local debounce = true RemoteEvent.OnServerEvent:Connect(function(player) local bomb = game.ServerStorage.Bomb:Clone() bomb.Parent = workspace bomb.Anchored = true bomb.CanCollide = false bomb.Position = player.Character.Head.Position + Vector3.new(0, 10, 0) bomb.Ma

1 answer

✓ Accepted answer

Not sure if this is what you wanted but you could try it.

script.Parent.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("BotHumanoid") then
			hit.Parent.BotHumanoid:TakeDamage(5)
	end
end)

1 comment

0

Also change the (5) to whatever you'd like.

This discussion is preserved as it was. New answers, comments, and votes are closed.