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: Not sure if this should be in a script or a local script

Previous Thread :: Next Thread 
xKillerGuy18x is not online. xKillerGuy18x
Joined: 07 Oct 2012
Total Posts: 216
01 Aug 2015 06:18 PM
Any ideas why this isn't working?


function ok()
game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(Vector3.new(0, 0, 0))
end
script.Parent.MouseButton1Click:connect(ok)
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
01 Aug 2015 06:24 PM
I'll give you a hint:
"LocalPlayer"
Report Abuse
xKillerGuy18x is not online. xKillerGuy18x
Joined: 07 Oct 2012
Total Posts: 216
01 Aug 2015 06:25 PM
I know that, and i've placed it in a localscript, but it doesn't work then.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
01 Aug 2015 06:28 PM
function ok()
local plr = game.Players.LocalPlayer
local char = plr.Character
char:MoveTo(Vector3.new(0,0,0))
end
script.Parent.MouseButton1Click:connect(ok)

if you are doing anything related to guis, i'll just say it's bad practice to use a server script for something like that. guis/userinput should be handled with a local script.
Report Abuse
xKillerGuy18x is not online. xKillerGuy18x
Joined: 07 Oct 2012
Total Posts: 216
01 Aug 2015 06:37 PM
Doesn't work. Plus, doesn't :MoveTo make a player walk there?
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
01 Aug 2015 06:38 PM
@killer
where did you place the local script?
and when you call :MoveTo() on a model, it moves the whole model to the vector3 you provided as an argument
Report Abuse
xKillerGuy18x is not online. xKillerGuy18x
Joined: 07 Oct 2012
Total Posts: 216
01 Aug 2015 06:40 PM
@instawin

Workspace.Part.SurfaceGui.Frame.Textbutton
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
01 Aug 2015 06:55 PM
local scripts don't run inside of parts, only as descendants of the client

http://wiki.roblox.com/index.php?title=API:Class/LocalScript

just put that surfacegui inside of startergui, and make sure you set the surface gui's adornee to the desired part, via local script

you layout should look like this

startergui
--surfacegui
---yourframe
----yourbutton
-----local script in button
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