Ok I'm trying to animate a brick into a teleporter where it will go up if touched but when I teleport it does not go down all the way, it's saying this error: attempt to index field 'Parent' (a nil value)
How can I fix this?
gui.teleport.MouseButton1Click:connect(function()
if not selloc then return end
if(selloc.Group.Value ~= 0)then
local infoassoc = groupserv:GetGroupInfoAsync(selloc.Group.Value)
if(infoassoc and (not me:IsInGroup(selloc.Group.Value)))then
gui.cardview.grouperror.Text = "Teleport Failed: You're not in the group \""..infoassoc.Name.."\""
gui.cardview.grouperror.Visible = true
return
end
end
local teleport = Instance.new("IntValue", me)
teleport.Name = "JustTeleported"
game:GetService("Debris"):AddItem(teleport, 5)
gui.Visible = false
wait(2)
porter.User.Value = nil
me.Character:MoveTo(selloc.Porter.Position)
me.Character.Humanoid.WalkSpeed = 16
for i = 1,10 do
local Part = game.workspace['Instant Teleport'].Union
Part.CFrame = Part.CFrame * CFrame.new(0,-1,0)
wait(1)
script.Parent:Destroy() -- Error occurs here
end
end)

1 comment
Your'e going to need to provide more context . . . The problem is being caused by another part of this script.