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

i want to make sword but it's not working?

Asked by 4 years ago

i wrote a script like this i saw it in youtube but it's not working

script.parent.Touched:connect(Function(hit)

hum = hit.Character:FindFirstChild("Humanoid")
hum:TakeDamage(10)

end)

can any body tell me what's wrong with this?

0
thanks it worked tnt54868726 3 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Parent should have a big P. Why are you using Character? The object is already in workspace. Use Hit.Parent:FindFirstChild("Humanoid")

Character gets the character if the object is inside the player folder. Anything inside the player folder is not an object that can register a touched event.

0
can you tell me an anwser? tnt54868726 3 — 4y
0
i mean an example tnt54868726 3 — 4y
0
All you have to do is change line 1 and 3. Line 3 should be Use Hit.Parent:FindFirstChild("Humanoid") and line 1 scirpt.Parent.Touched:Connect(function(Hit) Thesquid13 301 — 4y
0
i have another question why we do have to write hit.parent? why we are not using hit just alone tnt54868726 3 — 4y
0
Because your arm is not the humanoid. Thesquid13 301 — 4y
Ad

Answer this question