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: Help

Previous Thread :: Next Thread 
Superfryx is not online. Superfryx
Joined: 01 Aug 2011
Total Posts: 3253
24 May 2013 04:37 PM
I am experimenting with guis. But why won't this work. It makes it so when you click on a button it gives you a tool and then teleports you. In the output it said
Players.Player1.PlayerGui.ScreenGui.Frame.TextButton.Script:4: attempt to index global 'Player' (a nil value)

Also how do I make it remove the gui when you click it?



local Text=script.Parent
local Tel2=game.Workspace.Tel2
local Gear=script.Parent.Tool
local Location=game:GetService('Players'):GetPlayerFromCharacter(Player.Parent)--Finds player folder for our player
local New=Gear:Clone()
local Player=game.Players.LocalPlayer.Character

function onClick()
New.Parent=Location.Backpack
--------------------------------------------------------------------------
Player.Torso.CFrame = CFrame.new(Tel2.Position+Vector3.new(0,3,0))--Moves player to teleporter but up 3 studs higher t.MouseButton1Click:connect(onClick)
end
Text.MouseButton1Click:connect(onClick)
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
24 May 2013 04:41 PM
Because 'Player' is defined after you trying to use the variable. Also, you're trying to use ':GetPlayerFromCharacter()' on Workspace.
Report Abuse
Superfryx is not online. Superfryx
Joined: 01 Aug 2011
Total Posts: 3253
25 May 2013 09:41 AM
I dont get it. Im really new to scripting and guis. I tried some stuff but it didnt work.
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
25 May 2013 09:55 AM
Put the 'local Player = Bleh Bleh' bit before the line that tries using it...
Report Abuse
Superfryx is not online. Superfryx
Joined: 01 Aug 2011
Total Posts: 3253
26 May 2013 10:26 AM
It acctully matters where I use locals?
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
26 May 2013 10:37 AM
It matters where you define anything... You've got to define the variable before the line that another tries using it, if that makes sense.

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