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

Error while attempting to teleport part to player?

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

✓ Accepted answer

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   

4 comments

0

Hope this helped:=) if you get anymore errors I can help you out on discord:=)

0

I actually destroy the sockwave after already. With a debris folder along with the projectile

0

Oh nice.

0

Glad it helped.

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.

2 comments

0

Correct. But shouldn't you destroy the shockwaveclone when the script reaches end?

0

yes but its just a small example of how to set things up

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