script.Parent.Gas.Touched:Connect(function(Hit)

    if Hit.Parent:FindFirstChild("Humanoid") then
    
    Hit.Parent:MoveTo(script.Parent.Teleporter.Position)
    
    end
    
    end)

https://gyazo.com/ed1012dc08f06a3cbae5a6c9800da5e4 It spawns on top of those black things at the top. I want the player to teleport inside the red thing when they get teleported. How do I make it so it does not teleport the player on top?

For anyone wondering, here is the working code:

script.Parent.Gas.Touched:Connect(function(Hit)

if Hit.Parent:FindFirstChild("Humanoid") then

Hit.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.Teleporter.Position))

end

end)

5 comments

0

Within the model add a part called teleport position and cet the CFrame/Position to that

0

I did, it won't work. It is even under the map. And it teleports on top.

0

If you change using Position then the part will be put on top of the other part if there is no room. Swap to set CFrame using https://developer.roblox.com/api-reference/function/Model/SetPrimaryPartCFrame

0

Alright, it works now. Thank you.

0

MoveTo will automatically place you above the object