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: SurfaceGui TextButtons - Help, anyone?

Previous Thread :: Next Thread 
Qrypsa is not online. Qrypsa
Joined: 10 Jul 2013
Total Posts: 1867
06 Jun 2014 03:42 PM
I'm an amateur scripter btw, before you have a go at my nooby scripts.

I've got a SurfaceGui with some TextButtons in it. The scripts in the TextButtons worked perfectly well when they're in a ScreenGui, but for some reason switching to Surface stops them from working.

An example of a script:

print("teleport")
player = game.Character
function onClicked()
player.Torso.CFrame = game.Workspace.AdultColours.CFrame + Vector3.new(0,4,0)
end

script.Parent.MouseButton1Click:connect(onClicked)

Well, there might be something wrong with the script itself because I changed a couple of things, but I've tried changing the way the script goes to the location of Character, I've put it in a LocalScript... Nothing works. How come? Can someone tell me how to make TextButtons work on SurfaceGuis?
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
06 Jun 2014 03:44 PM
>player = game.Character

random variables are random
Report Abuse
Qrypsa is not online. Qrypsa
Joined: 10 Jul 2013
Total Posts: 1867
06 Jun 2014 03:48 PM
Okay, so that bit's wrong - which is strange, because before the script kept going ".Parent" until it got to game, then went to ".Character".

Mind telling me the right variable? c:
Report Abuse
Kirbyfan56 is not online. Kirbyfan56
Joined: 29 Oct 2007
Total Posts: 179
06 Jun 2014 04:08 PM
player = game.Players.LocalPlayer
function onClicked()
player.Character.Torso.CFrame = game.Workspace.AdultColours.CFrame + Vector3.new(0,4,0)
print("teleport") -- why add the teleport print before the script?
end
script.Parent.MouseButton1Down:connect(onClicked)

--localscript
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