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: CFraming script help

Previous Thread :: Next Thread 
Eclipsin is not online. Eclipsin
Joined: 09 Feb 2012
Total Posts: 5197
27 Dec 2013 07:49 PM
Can anyone tell me why this isn't working?

--

function onClick(x)

script.Parent.Parent.Visible = false
x.Character.Torso.CFrame = CFrame.new(Vector3.new(-28.5, 1.8, 38))

end

script.Parent.MouseButton1Click:connect(onClick)
Report Abuse
Nagrath99 is not online. Nagrath99
Joined: 26 Mar 2011
Total Posts: 1537
27 Dec 2013 07:54 PM
It may be that x isn't labelled as a Player.
Use game.Players.LocalPlayer.Character.Torso.CFrame (if in a LocalScript)
or since the script.Parent.Parent is not visible, the script is deactivated. So you need to have it invisibilized after.
Report Abuse
ozzzyt is not online. ozzzyt
Joined: 08 Jan 2013
Total Posts: 3576
27 Dec 2013 07:54 PM
I don't know, sorry.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Dec 2013 07:55 PM
x is not a player object returned by the MouseButton1Click event
Report Abuse
Eclipsin is not online. Eclipsin
Joined: 09 Feb 2012
Total Posts: 5197
27 Dec 2013 08:00 PM
It says that x == nil

Why is that, and how can I make it so it is the player?

-{E_
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Dec 2013 08:08 PM
Is this a local script? If so:

function onClick(x)

script.Parent.Parent.Visible = false
x.Character.Torso.CFrame = CFrame.new(Vector3.new(-28.5, 1.8, 38))

end

script.Parent.MouseButton1Click:connect(function() onClick(Game.Players.LocalPlayer) end)


If not, replace Game.Players.LocalPlayer to script.Parent.Parent.blahblah
Report Abuse
Eclipsin is not online. Eclipsin
Joined: 09 Feb 2012
Total Posts: 5197
27 Dec 2013 08:12 PM
It worked, thanks.

-{E_
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