Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago




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)
0
What errors are you getting? Did you properly define Jbrick? joritochip 705 — 5y
0
yes chuba143 -3 — 5y
0
Please include the full script, as we do not know what Jbrick is defined as. joritochip 705 — 5y
0
yay HappyTimIsHim 652 — 5y
0
XD\ chuba143 -3 — 5y

4 answers

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

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

Ad
Log in to vote
3
Answered by 5 years ago
Edited 5 years ago
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.

0
upvote and mark if it helped :) HappyTimIsHim 652 — 5y
0
lol true human HappyTimIsHim 652 — 5y
0
:/ HappyTimIsHim 652 — 5y
Log in to vote
2
Answered by 5 years ago

Simply just change

Joshpart.Visible = true

To

Joshpart.Transparency = 1

and do the oposite to make it invisible :)

0
Transparency `1` is completely invisible. EpicMetatableMoment 1444 — 5y
Log in to vote
1
Answered by 5 years ago

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

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

Answer this question