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

Error while attempting to teleport part to player?

Asked by 4 years ago
Edited 4 years ago

Well, I'm working on a projectile and its almost done but I need to finish the shockwave. I did not know how to do it but I found this script that worked. When the projectile hits the enemy then it makes the shockwave but it only workes once. I have provided my code/error below.

local shockwavemesh = game.ReplicatedStorage.Storage.Others.BlackholeShockwave
                --shockwave
                shockwavemesh:Clone()
                shockwavemesh.Parent = Hit
                shockwavemesh.Position = Vector3.new(Hit.Parent.HumanoidRootPart)
    -- tween shockwave      
    local shockgoal = {}
    shockgoal.Size = Vector3.new(30, 30, 30)

    local stweenInfo = TweenInfo.new(7)

    local stween = TweenService:Create(shockwavemesh, stweenInfo, goal)
    stween:play()
    --end   

Error: 15:29:50.166 - The Parent property of BlackholeShockwave is locked, current parent: NULL, new parent LeftHand

2 answers

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

Try putting

shockwavemesh:Clone() 

in a variable. Like

local shockclone = shockwavemesh:Clone()

Maybe this will work. Idk

local shockwavemesh = game.ReplicatedStorage.Storage.Others.BlackholeShockwave
                --shockwave
                local shockclone = shockwavemesh:Clone()
                shockclone.Parent = Hit
                shockclone.Position = Vector3.new(Hit.Parent.HumanoidRootPart)
    -- tween shockwave      
    local shockgoal = {}
    shockgoal.Size = Vector3.new(30, 30, 30)

    local stweenInfo = TweenInfo.new(7)

    local stween = TweenService:Create(shockclone, stweenInfo, goal)
    stween:play()
    --end   

A quick brief explanation is that it works only 1 time since that's when you haven't changed any properties. But when the script has run once. The properties are different. So your script might get errors since values might be different. Maybe you should destroy the shockclone after your script is done. So you don't get a lot of shockwaves:=) comment if there are other problems.

And if you wanna destroy the shockwaveclone then do this--

local shockwavemesh = game.ReplicatedStorage.Storage.Others.BlackholeShockwave
                --shockwave
                local shockclone = shockwavemesh:Clone()
                shockclone.Parent = Hit
                shockclone.Position = Vector3.new(Hit.Parent.HumanoidRootPart)
    -- tween shockwave      
    local shockgoal = {}
    shockgoal.Size = Vector3.new(30, 30, 30)

    local stweenInfo = TweenInfo.new(7)

    local stween = TweenService:Create(shockclone, stweenInfo, goal)
    stween:play()
    shockclone:Destroy()
    --end   
0
Hope this helped:=) if you get anymore errors I can help you out on discord:=) Skydoeskey 108 — 4y
0
I actually destroy the sockwave after already. With a debris folder along with the projectile XxWingKing 96 — 4y
0
Oh nice. Skydoeskey 108 — 4y
0
Glad it helped. Skydoeskey 108 — 4y
Ad
Log in to vote
0
Answered by
ArtBlart 533 Moderation Voter
4 years ago

It appears that you are actually tweening and messing with the part in ReplicatedStorage instead of the one you cloned. This is a pretty simple fix, all you need to do is set the cloned part to a variable, and reference the variable when doing things like tweening. Here's an example.

local shockwavemesh = game.ReplicatedStorage.Storage.Others.BlackholeShockwave

local cloned = shockwavemesh:Clone()
cloned.Parent = Hit
cloned.Position = Vector3.new(Hit.Parent.HumanoidRootPart)

Hope this helps! If you have any further questions feel free to comment or look things up on the devforum.

0
Correct. But shouldn't you destroy the shockwaveclone when the script reaches end? Skydoeskey 108 — 4y
0
yes but its just a small example of how to set things up ArtBlart 533 — 4y

Answer this question