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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 06 Apr 2013 |
| Total Posts: 12569 |
|
|
| 24 Jun 2015 12:10 AM |
| This is one of the most simple scripts.. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 743 |
|
| |
|
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 |
|
|