Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Any help with player teleportation?

Asked by
Aeike 9
7 years ago

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.

0
Line 36 should be: player.Character:MoveTo(a.Nape.Position) Validark 1580 — 7y
0
For future reference @Aeike the CFrame would have been done by player.Character.Torso.CFrame = CFrame.new(a.Nape.CFrame) Warfaresh0t 414 — 7y
0
@Warfaresh0t ..."CFrame.new(a.Nape.CFrame" it wouldn't work at all. Torso.CFrame = a.Nape.CFrame personal_ly 151 — 7y
0
.Position, sorry Warfaresh0t 414 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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.

Ad

Answer this question