You can write your topic however you want, but you need to answer these questions:
So, I am relatively new to scripting and the game I have created using a guide has been to the point where I am putting my own touches to it.
The GUI currently is not my taste and I would like to script a GUI that appears above a part on mouse click.
I am creating a Tower defence and want the GUI to show when I click a tower to then upgrade it, sell it etc. (All the code for the upgrading etc is complete, just cannot get the Gui that allows it to be parented or adornee onto the head of the tower.
So, what I am ultimately trying to do is scrap the scripts for the current GUI and have it so the info that is circled RED appears above the tower. and the circled info in yellow in a hot bar at the bottom. I believe I understand how to do the hot bar side of things though.
- I have looked at the dev page to read and understand it, I believe I ultimately need to use a billboard GUI? but when I try to achieve this, it does not work BUT i ultimately believe I am scripting it incorrectly.
I joined a few Discord groups where I can pay for the service of them tweaking the scripts for me but as soon as I explain want, I want to achieve I get radio silence.
Thank you for any help I get in this matter, if someone has got a detailed explanation of what I need to do, if they could also point me in a direction of a guide that will increase my knowledge.
what have you tried so far? Do you know where to start? It’s hard to help without knowing your scripting level, since if you don’t know what you’re doing at all, then it ends up just being forumers here writing your code for you. If you just want some tips that you can take the rest of the way, that’s a different thing.
Yes, use a BillboardGui with its Adornee property set to a part somewhere in the tower. You can toggle
BillboardGui.Enabled when they click a tower part. An easy way to do this is something like:
local mouse = game.Players.LocalPlayer:GetMouse()
for _, tower in towers do
local clickedThisTower = mouse.Hit:IsDescendantOf(tower)
tower.billboardGui.Enabled = clickedThisTower
and then just fill in the blanks for the variables.
Thank you for the response, I believe I have nearly got this done.
I am just struggling with the sizing and positioning of the GUI itself I hate doing the GUI for this reason .
The next question and sorry If this is a stupid one, I have my towers in replicated storage. So if I adornee the Billboard to say the towers head for example. How would I call it to do that for whichever tower gets spawned in. Or am I able to Adornee to the object itself?
I have attached images to show what I mean. I am playing with the numbers and will not go right above his head. Im guessing I need to play around with the frames?
Which would require me to read some info on it and understand it better as I obviously don’t understand the sizing and positioning properties.
So I have it displaying correctly BUT the UI is too low and I need to raise it. Normally the StudOffset would fix this but still appearing below Tower
You can’t set the X Y or Z of a vector individually. You could do either of these:
BillboardGui.StudsOffsetWorldSpace = Vector3.new(0, 2, 0)
BillboardGui.StudsOffsetWorldSpace = Vector3.yAxis * 2
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.