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

how do i get an instance to occur at a part in game.workspace?

Asked by 6 years ago
Edited 6 years ago

I've recently learned how to get instances to spawn but what I want to know is how do I get an instance to occur at a part that's in workspace. I wanted my script to send the new instance to occur at its parent which is a part the instance I was using is an explosion this is what I tried

local run=true

    while run do

        E=Instance.new("Explosion",game.workspace.Explosive)

            wait(4)

                end

Explosive is "Explosion's" parent which is a part so I thought if I transferred the child to the part it would send it there but when I tried it still just made an explosion in the center of the world how can I make it explode at its parent instead of the center of the world. Thanks

0
Please use code blocks. Not using them will make about 95% of us not want to help you. lukeb50 631 — 6y
0
sorry about that idk why it was blocking the code. redjacob02 20 — 6y
0
Read my bio. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

all you have to do is set the position after parenting it

local run = true
while run do
    E=Instance.new("Explosion", workspace.Explosive) -- workspace is a shortcut to game.Workspace
    E.Position = workspace.Explosive.Position -- will not work if "Explosive" is a model
    wait(4)
end
0
thx redjacob02 20 — 6y
Ad

Answer this question