2DWorlds Forums
How do I insert a UI? - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Help (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=21)
+--- Thread: How do I insert a UI? (/showthread.php?tid=5246)

Pages: 1 2


How do I insert a UI? - Glome - 06-01-2011

I can't find a Start UI folder or anything like that.

Oh and are the UI's similar to roblox's?


RE: How do I insert a UI? - Qwertygiy - 06-01-2011

I'd assume you start by adding a Character, building the UI in the PlayerUI of it, then when you're done, put it inside a Script in the workspace that copies it into their PlayerUI.


RE: How do I insert a UI? - Jacob__mybb_import1 - 06-01-2011

You can store the UI anywhere, then use a script to copy it into new players, or just generate it with a script every time someone joins.


RE: How do I insert a UI? - Glome - 06-01-2011

Can someone post a script for this? xD

I'm not to good at lua lol


RE: How do I insert a UI? - AK-47 - 06-03-2011

I don't get it... Where does UI have to be so that a player can see it on-screen?


RE: How do I insert a UI? - Jacob__mybb_import1 - 06-03-2011

game.Players.Player.UI


RE: How do I insert a UI? - AK-47 - 06-03-2011

Thanks!

Also, I already made a health bar UI, the only problem is after dying, the script won't run again, so the bar just stays red. Help?


RE: How do I insert a UI? - Kieron - 06-03-2011

(06-03-2011, 03:08 PM)Jacob_ Wrote: game.Players.Player.UI

So that's how it's done.


RE: How do I insert a UI? - Jacob__mybb_import1 - 06-03-2011

(06-03-2011, 03:16 PM)AK-47 Wrote: Thanks!

Also, I already made a health bar UI, the only problem is after dying, the script won't run again, so the bar just stays red. Help?

Wouldn't something like this work?

[lua]
link(game.World.ChildAdded, function( c )
if c:isA("Character") then
local player = game.Players[c.Name]
--create UI
link(c.PropertyChanged, function(name, value)
if name == "Health" then
--update health bar
end
end
end
end)
[/lua]


RE: How do I insert a UI? - AK-47 - 06-03-2011

[lua]
function onEnter( c )
if c:isA("Character") then
local player = game.Players[c.Name]
local HealthScript = script.Parent.HealthScript:clone()
HealthScript.Parent = player.UI
end
end
link(game.World.ChildAdded, onEnter)
[/lua]

But it won't work. (I'll work on the updater later)