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

why im i getting this error when im trying to damage to the dummy?





workspace['Rasengan test dummy'].Humanoid.Touched:Connect(function(Rasengan)
	   if (Rasengan) ~= nil then	      local Humanoid = Rasengan.Parent:FindFirstChild(“Humanoid”) or Rasengan.Parent.Parent:FindFirstChild(“Humanoid”)
	      if (Humanoid:IsA(“Humanoid”) and Humanoid) then
	         for i = 1,10,10 do
	            Humanoid:TakeDamage(10)
	         end
	      end
	   end
	end)




5 comments

0

What errors are you getting? Did you properly define Jbrick?

0

yes

0

Please include the full script, as we do not know what Jbrick is defined as.

0

yay

0

XD\

4 answers

✓ Accepted answer

Your issue is being caused because you’re trying to use the method :TakeDamage() on the Part you touched, yet the Part you thing you touched, isn’t a Humanoid. When using.Touched you use the arguments provided by the function, which is the part that touched. This would be, what you gave it as a reference in the perimeters, ‘Rasengan‘. This should then be written like so

workspace[“Rasengan test dummy”].Humanoid.Touched:Connect(function(Rasengan)
   if (Rasengan) ~= nil then
      local Humanoid = Rasengan.Parent:FindFirstChild(“Humanoid”) or Rasengan.Parent.Parent:FindFirstChild(“Humanoid”)
      if (Humanoid:IsA(“Humanoid”) and Humanoid) then
         for i = 1,10,10 do
            Humanoid:TakeDamage(10)
         end
      end
   end
end)

You also forgot a peramiter on the for loop, the third number is how much it does up

script.Parent.Touched:Connect(function(hit) 
	Jbrick.Anchored = true 
	human1 = hit.Parent --idk what this is for
	human = hit.Parent:FindFirstChild('Humanoid')
	if human then --checks if human is true
		human:TakeDamage(10)
		print('yes')
	end
end)

small error ur doing hit.Parent:FindFirstChild("Humaoid") so it will be nil. i fixed it to be humanoid. a model can't take damage so a humanoid can take damage.

3 comments

0

upvote and mark if it helped :)

0

lol true human

0

:/

Simply just change

Joshpart.Visible = true

To

Joshpart.Transparency = 1

and do the oposite to make it invisible :)

1 comment

0

Transparency 1 is completely invisible.

PlayerAdded is not an event of StarterPack, but an event of Players.

1 comment

0

Also assuming that joshpart is a Part, visible is not a thing. The right thing to do would be joshpart.Transparency = 0

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