Hi!
The title says it all, how would I make the player teleport to a model?
Thanks for any help!
No responses yet, does anybody have a solution?
Set the character’s HumanoidRootPart
position to the model’s position.
Like this?
game.Players.LocalPlayer.Character.HumanoidRootPart.Position = 1,2,3
Character.HumanoidRootPart.CFrame = teleporter.CFrame
Make teleporter a block in your game.
A varaible.
Make it CanCollide = False
Anchored = True
If invisible then transparentsy = 1
In a local script do:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.Character:Wait()
local Part = (where it is located)
Character.HumanoidRootPart.CFrame = Part.CFrame * CFrame(0,3,0) -- You don't want the player to spawn in the part!!
Testing now.
The parts probably aren’t loaded yet.
i will add a wait
Use a WaitForChild()
.
(limit)
local db = false
game.Players.LocalPlayer.BuildMode.Changed:Connect(function()
if db == false then
print ("Build mode entered!")
db = true
script.Parent.Sound:Play() -- play sound
script.Parent.Sound.TimePosition = 0 --reset sound
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.Character:Wait()
local Part = workspace:WaitForChild("Plots.Plot1.Mailbox.TPPart",10)
Character.HumanoidRootPart.CFrame = Part.CFrame * CFrame(0,3,0)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0
----------tween everything----------
script.Parent.ControlBar:TweenPosition(UDim2.new(0.91, 0, 0.089, 0), "In", "Quint", 1.4, true)
script.Parent.Main:TweenPosition(UDim2.new(0.024, 0, 0.728, 0), "In", "Quint", 1.4, true)
script.Parent.Exit:TweenPosition(UDim2.new(0.059, 0, 0.078, 0), "In", "Quint", 1.4, true)
script.Parent.FlexPoints:TweenPosition(UDim2.new(0.024, 0, 0.03, 0), "In", "Quint", 1.4, true)
----------increase sound----------
for i = 1,500 do
script.Parent.Parent.WelcomeScreen.MainScreen.Play.BG.Volume -= 0.01
wait(0.0001)
end
for i = 1,10 do
script.Parent.Sound.Volume += 0.1
wait (0.5)
end
elseif db == true then
print ("Build mode left!")
db = false
----------tween everything----------
script.Parent.ControlBar:TweenPosition(UDim2.new(1, 0, 0.089, 0), "Out", "Quint", 1.4, true)
script.Parent.Main:TweenPosition(UDim2.new(0.024, 0, 1, 0), "Out", "Quint", 1.4, true)
script.Parent.Exit:TweenPosition(UDim2.new(-0.2, 0, 0.078, 0), "Out", "Quint", 1.4, true)
script.Parent.FlexPoints:TweenPosition(UDim2.new(-0.3, 0, 0.03, 0), "Out", "Quint", 1.4, true)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 18
game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50
----------increase sound----------
for i = 1,100 do
script.Parent.Sound.Volume -= 0.01
wait (0.01)
end
script.Parent.Sound:Stop() --stop sound
script.Parent.Sound.TimePosition = 0 --reset sound
wait (3)
for i = 1,500 do
script.Parent.Parent.WelcomeScreen.MainScreen.Play.BG.Volume += 0.01
wait (0.001)
end
end
end)
How soon does BuildMode
change? You really shouldn’t need a WaitForChild()
in there if it’s not instantly. WaitForChild()
only works for one instance, so in your case you’d want to do workspace:WaitForChild("Plots"):WaitForChild("Plot1"):WaitForChild("Mailbox"):WaitForChild("TPPart")
CFrame(0,3,0)
should be CFrame.new(0,3,0)
Character.HumanoidRootPart.CFrame = Part.CFrame * CFrame.new(0,3,0)
The error is still in that line, indexing nil with CFrame
What have you defined the Part
as? Try doing local Part = workspace.Plots.Plot1.Mailbox.TPPart
game.Players.LocalPlayer.Character:MoveTo(workspace.Model.Position)
Make a part over the mailbox.
The mailbox is a model not a part.