Need help with my portal

i’m trying to make a simple portal that teleports you to the “Level3” part in workspace.

it doesn’t teleport me, and doesn’t give me an error.

my script:

script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent)then
		hit.Parent.HumanoidRootPart.CFrame = game.Workspace.Level3.CFrame
	end
end)

my error:

Level3 is not a valid member of Workspace "Workspace"  -  Server - Script:3



thanks

it says “Level3 is not a valid member of Workspace”, maybe its level3 (small L)?

You might use :ToWorldSpace() Cause the you spawn at the exact place of the lvl3 part

And try making a variable of lvl3 maybe that will work cause, i have that same error too but when i created a variable it was solved.

The error is telling you it can’t find anything in workspace with the name “Level3”. It is case sensitive so double check if the names match.

image

it has the right capitilization.

Is it under a model?

XXXX-XXXX-XXXX

is it directly under workspace

1 Like

nope it’s in the portal

very confusing lol

nope it’s inside of the portal

Oh.
Do this:

hit.Parent.HumanoidRootPart.CFrame = game.Workspace.Portal.Level3.CFrame

Can you show the explorer? You will need to navigate through the workspace until you reach the part.

So if you have a folder inside workspace and the folder has a part, to reach that part you will need to do game.Workspace.Folder.Part and not game.Workspace.Part

no, the level3 part is in the workspace, and not in the portal.

Try this:

local function FindDescendant(Inst, Obj)
 if Inst:FindFirstChild(Obj) then
  return Obj
 else
   for _, v in pairs(Inst:GetDescendants()) do
     if v.Name == Obj then
       return v.Parent:FindFirstChild(Obj)
     else
       return false
  end
 end
end

local Level3 = FindDescendant(workspace, "Level3")

bruh.

just do

workspace:FindFirstChild("Level3", true)

How does that find the descendant, though?

image

Ah, sorry. Never knew the recursive meant that it searches through its descendants.

1 Like

Try changing It Like This.
You may want to use Head Instead of HumanoidRootPart.
Or you can just use PrimaryPart.

local Level3Part = workspace:WaitForChild("Level3")

script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent)then
		hit.Parent.Head.CFrame = Level3Part.CFrame
	end
end)

This may be a problem on a not loaded part as well.
Hope It helped.

1 Like

Make sure that the model/object is named correctly in the workspace and make sure it’s parent is in workspace.