Hello, i will know why i can’t destroy my part if she isn’t in a table,
this is the script:
local hasTouched = false
local TweenService = game:GetService("TweenService")
local launchRemote = game.ReplicatedStorage.Fruits["Tori Tori no mi"]:WaitForChild("LaunchEffects")
local tweenInfo = TweenInfo.new(
2,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.InOut,
0,
false,
0
)
launchRemote.Event:Connect(function()
local check = workspace:FindPartsInRegion3(Region3.new(script.Parent.Position - (0.5 * script.Parent.Size), script.Parent.Position + (0.5 * script.Parent.Size)), script.Parent)
script.Parent.Size = Vector3.new(0.05,0.05,0.05)
script.Parent.Transparency = 0
if not check then
print("Destroying the part", script.Parent.Name)
script.Parent:Destroy()
return
end
for i, v in pairs(check) do
print(script.Parent.Name, v)
end
check = check[1]
script.Parent.Color = check.Color
script.Parent.Material = check.Material
local playTween = TweenService:Create(script.Parent, tweenInfo, {Size = Vector3.new(4,4,4)})
playTween:Play()
wait(8)
local secondTween = TweenService:Create(script.Parent, tweenInfo, {Size = Vector3.new(0.05,0.05,0.05)})
secondTween:Play()
wait(2)
script.Parent:Destroy()
end)