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: I can't understand why this won't work

Previous Thread :: Next Thread 
MrParkwizard is not online. MrParkwizard
Joined: 28 Feb 2011
Total Posts: 679
16 Aug 2013 09:32 PM
server = _G.server = {}
ektic = _G.server
ektic.createGui = function(Parent, x, y, Sx, Sy, Name, Type)
local gui = Instance.new(Type)
gui.Parent = Parent
gui.Name = Name
if(gui.ClassName ~= ScreenGui) then
gui.Position = UDim2.new(0,x,0,y)
gui.Size = UDim2.new(0, Sx, 0, Sy,0)
end
end
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
16 Aug 2013 09:36 PM
if(gui.ClassName ~= ScreenGui) then
Errors because ScreenGui isn't in parentheses


if gui:IsA("ScreenGui") then

would work
Report Abuse
MrParkwizard is not online. MrParkwizard
Joined: 28 Feb 2011
Total Posts: 679
16 Aug 2013 09:39 PM
Its printing out this error

19:37:56.336 - ektic.createGui(game.StarterGui:FindFirstChild("ScreenGui"):1: attempt to index global 'ektic' (a nil value)
19:37:56.338 - Script "ektic.createGui(game.StarterGui:FindFirstChild("ScreenGui")", Line 1
19:37:56.339 - stack end
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
16 Aug 2013 09:40 PM
UnAdmin meant, wasn't in QUOTATIONS, that is, it's not a String-literal.

if gui.ClassName ~= "ScreenGui" then

would also work (although :IsA is a nice thing to have).

Also, since it's ~=, it his correction should


if not gui:IsA("ScreenGui") then
Report Abuse
MrParkwizard is not online. MrParkwizard
Joined: 28 Feb 2011
Total Posts: 679
16 Aug 2013 09:45 PM
Yes I get that but it's printing out this error when I type into the command bar ektic.createGui(game.StarterGui.ScreenGui,50,50,100,100,"Player","Frame")
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
16 Aug 2013 09:47 PM
Because ektic isn't defined for the command bar.

Use

_G.server for that, since that's what you called it.
Report Abuse
MrParkwizard is not online. MrParkwizard
Joined: 28 Feb 2011
Total Posts: 679
16 Aug 2013 09:50 PM
hmmm....that still doesn't work

_G.print = function(Text)
print(Text)
end
_G.print("Hello")

doesn't even work

it still prints out
19:50:32.978 - _G.print("Hello"):1: attempt to call field 'print' (a nil value)
19:50:32.979 - Script "_G.print("Hello")", Line 1
19:50:32.981 - stack end
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