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
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
|
| 06 Jun 2014 03:44 PM |
>player = game.Character
random variables are random |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|