generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: teleport on key???

Previous Thread :: Next Thread 
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
23 Jun 2015 11:33 PM
----wat

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

Mouse.KeyDown:connect(function(Key)
if Key=="e" then
local tag = Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
Player.Character.Humanoid.Torso.CFrame = CFrame.new(-7932.696, 28.329, -10.791)

end
end
end
end)
--not sure why this isn't working, please help! :)

I'm not going to stop the internet, I'm going to break the internet
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
23 Jun 2015 11:36 PM
bump

I'm not going to stop the internet, I'm going to break the internet
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
23 Jun 2015 11:36 PM
Humanoid is not defined (unless I've gone blind).
Also, you shouldn't be using KeyDown anymore, switch to UserInputService.

Post the output in the future
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
23 Jun 2015 11:44 PM
actually, I rewrote the script and it still doesn't work. :/


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

Mouse.UserInputService:connect(function(Key)
if Key=="e" then
Player.Character.Torso.CFrame = CFrame.new(-7932.696, 28.329, -10.791)
end

script.Parent.Mouse.UserInputService:connect(e)


I'm not going to stop the internet, I'm going to break the internet
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
23 Jun 2015 11:45 PM
There are many things wrong with that script.

Humanoids are stored under the player's character (player.Character) and UserInputService does not work like that.

Example UIS code from the wiki:

function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
print("R was pressed")
end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
23 Jun 2015 11:47 PM
----wat
local Player = game.Players.LocalPlayer
local Humanoid = Player.Humanoid
local Mouse = Player:GetMouse()

function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.E then
Player.Character.Torso.CFrame = CFrame.new(-7932.696, 28.329, -10.791)
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

still not working :/

I'm not going to stop the internet, I'm going to break the internet
Report Abuse
RegularTetragon is not online. RegularTetragon
Joined: 10 Oct 2009
Total Posts: 3085
23 Jun 2015 11:49 PM
Actually, you should use ContextActionService for mobile support.


It's delightful, It's delicious, It's delovely!
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
23 Jun 2015 11:51 PM
----wat
local Player = game.Players.LocalPlayer
local Humanoid = Player.Character
local Mouse = Player:GetMouse()

function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.E then
Humanoid.Torso.CFrame = CFrame.new(-7932.696, 28.329, -10.791)
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)


I'm not going to stop the internet, I'm going to break the internet
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
23 Jun 2015 11:54 PM
bump

I'm not going to stop the internet, I'm going to break the internet
Report Abuse
vvoods is not online. vvoods
Joined: 02 Nov 2013
Total Posts: 743
23 Jun 2015 11:57 PM
local Player = game.Players.LocalPlayer
local Humanoid = Player.Character
local Mouse = Player:GetMouse()

function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.E and not gameProcessedEvent then
Humanoid:MoveTo(Vector3.new(-7932.696, 28.329, -10.791))
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)



=volty=
Report Abuse
vvoods is not online. vvoods
Joined: 02 Nov 2013
Total Posts: 743
23 Jun 2015 11:58 PM
change human variable to this:

local Humanoid = Player.Character or Player.CharacterAdded:wait()



=volty=
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
24 Jun 2015 12:07 AM
local Player = game.Players.LocalPlayer
local Humanoid = Player.Character or Player.CharacterAdded:wait()
local Mouse = Player:GetMouse()

function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.E and not gameProcessedEvent then
Humanoid:MoveTo(Vector3.new(-7932.696, 28.329, -10.791))
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

error on line 10 b/c of an expected end @ line 5

I'm not going to stop the internet, I'm going to break the internet
Report Abuse
Despawned is not online. Despawned
Joined: 06 Apr 2013
Total Posts: 12569
24 Jun 2015 12:10 AM
This is one of the most simple scripts..
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
24 Jun 2015 12:11 AM
@despawned
then help??
im a very amateur scripter.

I'm not going to stop the internet, I'm going to break the internet
Report Abuse
MemeTrain is not online. MemeTrain
Joined: 27 Sep 2011
Total Posts: 2673
24 Jun 2015 12:16 AM
bump

I'm not going to stop the internet, I'm going to break the internet
Report Abuse
vvoods is not online. vvoods
Joined: 02 Nov 2013
Total Posts: 743
24 Jun 2015 01:07 AM
add another end



=volty=
Report Abuse
sm1t3 is not online. sm1t3
Joined: 04 Jun 2011
Total Posts: 103
24 Jun 2015 01:24 AM
you need 2 ends, one for the if then and one for the function

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image