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

I'm trying to make a *Press a key to teleport*And it doesn't work.Can you help me?

I'm making a Roleplay game and i was trying to make the doors like how the are in MeepCity.I press a specific key and it teleports me in the building. Thats what i've made.

Player = game.Players.LocalPlayer Mouse = Player:GetMouse()

Settings = {

CanTeleport = true;
WarpGui = true;t
TeleportKey = "e";t
TeleportTime = .1;


    }

   S = Settings

   UDIM = UDim2.new
   Mouse.KeyDown:connect(function(key)
local Enabled = true
if S.CanTeleport then
    if Enabled then
if key == S.TeleportKey then
Enabled = false
wait(S.TeleportTime)
if S.WarpGui then
local WarpGui = script.WarpGui:Clone()
WarpGui.Parent = Player.PlayerGui
for k = 0, 21, 1 do
WarpGui.MainFrame.Bar.Size = WarpGui.MainFrame.Bar.Size + UDIM(0, 10, 0, 0)
wait()
end
WarpGui:Destroy()
end

I tried to make it also with a GUI.But it doesn't work.

1 answer

this is only for the keyboard

Settings = {
	CanTeleport = true;
	WarpGui = true;
	TeleportKey = Enum.KeyCode.E;
	TeleportTime = .1;
	TeleporPart = workspace.PartTp --The player will move just in the position of this part.

}
local UserInput = game:GetService("UserInputService")
local S = Settings
local Enabled = true
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
UserInput.InputBegan:Connect(function(key)
	if key.KeyCode == S.TeleportKey then
		if S.CanTeleport then
			if Enabled then
				Character:MoveTo(S.TeleporPart.Position)
			end
		end
	end
end)

1 comment

0

Thank you

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