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
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
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.