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
 

Simple Question #2

Previous Thread :: Next Thread 
FisherPenguin is not online. FisherPenguin
Joined: 14 Jun 2010
Total Posts: 1157
29 Mar 2012 08:16 PM
How would you find the player that clicked on a GUI? (I'm trying to move a character when a button is clicked). But you don't have to give me a whole script with CFrame. I just need the line with the :finFirstChild() in it. Any help would be appreciated.

+-Fishy
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
29 Mar 2012 08:17 PM
LocalScript:

local plyr = game.Players.LocalPlayer

Reg Script:

local plyr = A lot of parents

† KMXD †
Report Abuse
Contemptus is not online. Contemptus
Joined: 27 Mar 2012
Total Posts: 368
29 Mar 2012 08:17 PM
You could either use like 6 parents, or you could... um, sorry I forgot.
Report Abuse
FisherPenguin is not online. FisherPenguin
Joined: 14 Jun 2010
Total Posts: 1157
29 Mar 2012 09:02 PM
Alright, well here's my script, pretty self explanatory. When a TextButton is clicked, the GUI disappears (Works), and then it is supposed to move your character to a certain point (Doesn't work). I don't exactly know how to fix this, I've never dealt with CFraming a player, only Vector3ing a brick :P Any help would be appreciated.

local b = script.Parent
local g = script.Parent.Parent.Parent
local player = game.Players.LocalPlayer

function onClicked(click)
if b.Name == "TextButton" then
g:destroy()
player.Torso.CFrame = player.Torso.CFrame.new(30, 4, -25)
end
end

script.Parent.MouseButton1Down:connect(onClicked)


+-Fishy
Report Abuse
FisherPenguin is not online. FisherPenguin
Joined: 14 Jun 2010
Total Posts: 1157
29 Mar 2012 09:24 PM
Bawmp.

+-Fishy
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
29 Mar 2012 09:29 PM
What is b, the GUI itself?
Report Abuse
FisherPenguin is not online. FisherPenguin
Joined: 14 Jun 2010
Total Posts: 1157
29 Mar 2012 09:40 PM
Nope. b is the TextButton. g is the GUI itself.

+-Fishy
Report Abuse
AboveAwesome is not online. AboveAwesome
Joined: 24 Jul 2010
Total Posts: 1823
29 Mar 2012 09:45 PM
Haha, I meant to ask what g was. Silly me.
Here you go.

local b = script.Parent
local g = script.Parent.Parent.Parent
local player = game.Players.LocalPlayer

function onClicked(click)
if b.Name == "TextButton" then
player.Character.Torso.CFrame = CFrame.new(30, 4, -25) -- The player and character are two different things. You want the character, not the player.
g:destroy() -- Put this after, as the gui being removed before would cause the script to stop running.
end
end

script.Parent.MouseButton1Down:connect(onClicked)
Report Abuse
FisherPenguin is not online. FisherPenguin
Joined: 14 Jun 2010
Total Posts: 1157
29 Mar 2012 09:50 PM
Ohhh ok, thanks :P

+-Fishy
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