Tank is not a valid member of Workspace "Workspace", a false error(maybe)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Be able to change parents without any errors or fails

  2. What is the issue? Include screenshots / videos if possible!
    I get an error that say it does not exist or just “Tank Is not a valid member of Workspace Workspace”
    here is a pic
    image

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Changing the line, many location checkings

script.Parent.Triggered:Connect(function()
	local Tanko = script.Parent.Parent.Parent.Tank
	local table = script.Parent.Parent.Parent.Tank:GetChildren()
	for i, v in pairs(table) do
		if v:IsA("Part") or v:IsA("UnionOperation") then
			local AbortDeselectText = script.Parent.Parent.Parent.Display.SurfaceGui["Abort/Deselect"].Text
			if AbortDeselectText == "Deselect" or AbortDeselectText == "" then
				v.Anchored = false
				script.Parent.Parent.Stats.Status.Value = "Detached"
				script.Parent.Parent.Parent.Display.SurfaceGui.Progress.Text = 0
				script.Parent.Enabled = false
				script.Parent.ActionText = "Couple"
				Tanko.Parent = game.Workspace -- here its supposted to be changed
				script.Parent.Parent.Parent.Tube.Touched:Connect(function(Toucher)
					if Toucher:IsA("Part") or Toucher:IsA("UnionOperation") then
						print("touched")
						if Toucher.Parent.Name == "Tank" then
							print("IsTank")
							script.Parent.Enabled = true
							script.Parent.Triggered:Connect(function()
								game.Workspace.Tank.Parent = script.Parent.Parent.Parent -- here is supposted to be changed back
								script.Parent.Enabled = false
								local TankPos = script.Parent.Parent.Parent.TankPlace.Position
								script.Parent.Parent.Parent.Tank.TankItself.Position = TankPos
								print("Moved")
								local table2 = script.Parent.Parent.Parent.Tank:GetChildren()
								for i, v in pairs(table2) do
								end
							end)
						end
					end	
				end)
			end
		end
	end
end)

You can do a yeild with WaitForChild()

1 Like

Looking at your code, it appears to be:

script.Parent = the ProximityPrompt
.Parent = BasePart
.Parent = Model
which sounds about right.


That wont do anything here. The Code thinks he is getting an Instance from the workspace, but he is trying to get it from the Model

1 Like

yes except the last .parent is a union, not a model.
So what do you think?

1 Like

could you show me where should I use it?

local Tanko = script.Parent.Parent.Parent:WaitForChild("Tank")

I doubt this fixes the problem though.

it did, at least partially. It only moved it out but now i can’t move it back to its original parent

Change this to workspace:WaitForChild("Tank").Parent = script.Parent.Parent.Parent

I was able to move it only twice again

Only twice or once?

aaaaaaaaa

I can move it only twice and i think i also meant twice there not once
Would you like me to reupload the code?

Yea, that would be helpful

sdkfjkldfjsgklfd


sorry if its in a picture i just cant upload it without it copying it fully.

1 Like

Change the table part to:

local table = Tanko:GetChildren()

On the 3rd line? Because I have to create a new table and my other ones are used so.

Is the proximity prompt enabled again?

script.Parent.Enabled = false

Is that why its not working??

Yup I do enable it somewhere down, when I trigger it it is supposed to move the model in and out of the workspace

Could the Tank be stored in replicated storage and moved in and out of there, or cloned from there and destroyed when you’re done with it?
Seems strange to have the script in the Tank when you are moving it in and out of the workspace.

I wanna change its ownership or something like that, also the script is not in the tank.