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: resizing a gui with a script

Previous Thread :: Next Thread 
clanky4 is not online. clanky4
Joined: 21 Oct 2009
Total Posts: 389
23 Jun 2013 08:49 PM
I am trying to make a script that will change the scale/size of a gui. Everything works fine until line 17 where it says that scale cannot be assigned. Here is the output:

0.966000021
never mind charlie
0.966000020504
21:46:05.703 - Scale cannot be assigned to
21:46:05.718 - Script "Players.Player1.PlayerGui.playerhud.healthoutline.health di", Line 17
21:46:05.718 - stack end


And here is the script:


while true do
wait()

local playername = script.Parent.Parent.Parent.Parent
local maxnumber = script.Parent.Healthgui.maxnumber.Value
local playerhealth = script.Parent.Health.Value
local playerhealthmax = script.Parent.MaxHealth.Value

--Time for some math!
local healthpercent = playerhealth / playerhealthmax
local healthbar = maxnumber * healthpercent

print(healthbar)
print("never mind charlie")
print(script.Parent.Healthgui.Size.X.Scale)

script.Parent.Healthgui.Size.X.Scale = healthbar

end
Report Abuse
clanky4 is not online. clanky4
Joined: 21 Oct 2009
Total Posts: 389
23 Jun 2013 09:26 PM
is it even possible to resize a gui with a script?
Report Abuse
TheSilentCow is not online. TheSilentCow
Joined: 12 May 2013
Total Posts: 74
23 Jun 2013 09:33 PM
http://wiki.roblox.com/index.php/ScreenGui

Try reading that, I am not aware of resize of a Gui.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
23 Jun 2013 09:38 PM
Gui.Size = UDim2.new(X-Scale,X-Offset,Y-Scale,Y-Offset)
Example:
Gui.Size = UDim2.new(0.2,0,0.22,0)
Report Abuse
clanky4 is not online. clanky4
Joined: 21 Oct 2009
Total Posts: 389
23 Jun 2013 09:50 PM
So I needed a weird UDim2.new before the numbers.

Thanks guys! its works fine now :D
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