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

Can i make press E teleport sys ?

Asked by
Tusi_1 17
4 years ago

I working on press E teleportsys or i have problems with press E !!!

1 answer

Log in to vote
0
Answered by 4 years ago

If I understand correctly, you want the character to teleport when you press E?

local userInputService = game:GetService("UserInputService")
local mouse = game.Players.LocalPlayer:GetMouse()
local character = game.Players.LocalPlayer.Character

userInputService.InputBegan:Connect(function(key) --Input detected!
    if key.KeyCode == Enum.KeyCode.E then --Checks if we pressed "e"
        character.HumanoidRootPart.CFrame = mouse.Hit --teleports the character to the mouse's position
    end
end)

For more information on keycodes and stuff, check out this article

0
THX !!! Tusi_1 17 — 4y
Ad

Answer this question