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

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

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?

1 comment

0

thanks it worked

1 answer

✓ Accepted answer

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.

5 comments

0

can you tell me an anwser?

0

i mean an example

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)

0

i have another question why we do have to write hit.parent? why we are not using hit just alone

0

Because your arm is not the humanoid.

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