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 » Scripting Helpers
Home Search
 

Re: Teleport on Click script

Previous Thread :: Next Thread 
lukeandxander is not online. lukeandxander
Joined: 22 Jun 2010
Total Posts: 12
11 Jun 2014 07:16 AM
I'm a newbie with scripting, and I have been working for the last 20 minutes to figure out what the problem is and I keep changing lines of code here and there. The point of the script is to teleport the player that clicks it to a certain location. I haven't really set the CFrame values yet.
Here's the script:

function onClicked(playerWhoClicked)

Workspace:FindFirstChild("Humanoid")

Humanoid.Parent.Torso.CFrame = CFrame.new(3, 3, 3)

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

*(end of script)*

The error I get happens only once I click the part. It reads that there was an attempt to index global "Humanoid" (A nil value)
Report Abuse
BriceRBLX is not online. BriceRBLX
Joined: 07 Jun 2014
Total Posts: 6
11 Jun 2014 07:19 AM
Supposed to be a gui?
Report Abuse
lukeandxander is not online. lukeandxander
Joined: 22 Jun 2010
Total Posts: 12
11 Jun 2014 07:22 AM
It is supposed to be a basic script which I inserted in a specially named Part. The part has a click detector and that script in it.
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
11 Jun 2014 07:26 AM
function onClicked(player)

Humanoid = player.Character:WaitForChild("Humanoid")

Humanoid.Parent.Torso.CFrame = CFrame.new(3, 3, 3)

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
lukeandxander is not online. lukeandxander
Joined: 22 Jun 2010
Total Posts: 12
11 Jun 2014 07:27 AM
It worked! Thanks a bunch. The problem was solved and now I teleport upon clicking the block.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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