Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Any help with player teleportation?

Here's my code.

-- Variables
player = game.Players.LocalPlayer
a = game.ReplicatedStorage.AeikeTitan:Clone()
b = game.ReplicatedStorage.Lightning:Clone()
c = game.ReplicatedStorage.Steam:Clone()
rep = game.ReplicatedStorage


-- Functions

function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.J and script.isTitan.Value == false then -- gets the key and isTitan value
		print("Titan Shift in action") -- for debugging
		b.Parent = game.Workspace
		b:SetPrimaryPartCFrame(player.Character.Torso.CFrame)
		script.Bolt:Play()
		wait(1)
		b:Destroy()
		a.Parent = game.Workspace
		a:SetPrimaryPartCFrame(player.Character.Torso.CFrame)
		player.Character.Humanoid.WalkSpeed = 0
		script.TitanRoar:Play()
		wait(0.1)
		script.isTitan.Value = true
		wait(30)
		a:Destroy()
		script.isTitan.Value = false
		player.Character.Humanoid.WalkSpeed = 16
	end
	end
 
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

-- TITAN TELEPORTATION
if isTitan == true then
	player.Character.Torso.CFrame.new(a.Nape.CFrame)
end

I gotta go to bed. Anything I did wrong? It seems as if "Titan Teleportation" isnt working.

4 comments

0

Line 36 should be: player.Character:MoveTo(a.Nape.Position)

0

For future reference @Aeike the CFrame would have been done by player.Character.Torso.CFrame = CFrame.new(a.Nape.CFrame)

0

@Warfaresh0t ..."CFrame.new(a.Nape.CFrame" it wouldn't work at all. Torso.CFrame = a.Nape.CFrame

0

.Position, sorry

1 answer

✓ Accepted answer

It looks like you made a syntax error:

in:

player.Character.Torso.CFrame.new(a.Nape.CFrame)

you aren't setting the CFrame of the object. Rather, you are just making a new CFrame. In order to change the CFrame, you should try:

player.Character.Torso.CFrame = a.Nape.CFrame

This sets the Torso's CFrame equal to where you want the Torso to be.

This discussion is preserved as it was. New answers, comments, and votes are closed.