Made this script recently and it does not work when its parent is changed. Is it a script that should work or did I write some weird script that wouldn’t work at all. It is a bit confusing since the script is trying to detect its own parent.
script.AncestryChanged:Connect(function(_, parent)
if parent.Name == "BulletTrail" then
local TS = game:GetService("TweenService")
local p = script.Parent
local Info = TweenInfo.new(1)
local Tween = TS:Create(p,Info,{Transparency=1})
Tween:Play()
Tween.Completed:Connect(function(playbackState)
print("Done")
p:Destroy()
script:Destroy()
end)
end
end)
Basically, I just want a script that can detect when its parent changes and if the parent is named “Bullettrail” it will run the following code.