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

Parenting an Object to Body Part?

Asked by 6 years ago

I am trying to parent fire to the player's left, but I don't know how. So far, I got this:

local pa = workspace:FindFirstChild("Left Arm")
if pa then
    local fire = Instance.new("Fire")
    fire.Parent = "Left Arm"
end

I am also trying to do it when the player hits the f key. How do I do that and how do I revise this code for the player's arm to be on fire?

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
6 years ago

You're really close. Set the Parent property to your pa variable.

local pa = workspace:FindFirstChild("Left Arm")

if pa then
    local fire = Instance.new("Fire")
    fire.Parent = pa
end

You can look into UserInputService's InputBegan event to see how to do this upon hitting the 'f' key.

Ad

Answer this question