|
| 14 Sep 2015 08:38 PM |
Soooo i'm trying to find a way to make my Armor GUI give hp (On-click)
Anyone know how one would do this? |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 08:48 PM |
ive seen it dont in the wiki before
your not who you are when you are who you are trying to be |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 08:48 PM |
done*
your not who you are when you are who you are trying to be |
|
|
| Report Abuse |
|
|
|
| 14 Sep 2015 09:07 PM |
button.MouseButton1Down:connect(function() end) |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:11 PM |
Let's say i have a ''Textbox'' (I Do) How do i make it that when you click that textbox it updates your current hp
For example
--Starts with 100 hp--- (Clicks Textbox) --Get's 250 Max hp--
U W0T M80? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:44 PM |
Also MouseButton1Down wouldn't work, MouseButton1Click would...yeees? |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:55 PM |
MAKE SURE THE SCRIPT IS A LOCAL SCRIPT
texting = [directory to textbox]
texting.MouseButton1Down:connect(function() game.Players.LocalPlayer.Character.Humanoid.Health = game.Players.LocalPlayer.Character.Humanoid.Health + 2 end) |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2015 09:57 PM |
Awwwww daum, forgot to make it local *Facepalm*
|
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Sep 2015 12:20 AM |
It didn't work because he set the Health, and not the MaxHealth:
texting = [directory to textbox] local MH = game.Players.LocalPlayer.Character.Humanoid.MaxHealth local H = game.Players.LocalPlayer.Character.Humanoid.Health
texting.MouseButton1Down:connect(function() MH = MH + 150 H = H + 150 - The health must be called after MaxHealth, or it won't work. end)
This will set MaxHealth to 250, and instantly set the Health to 250, so the character won't have to heal to get to 250 health.
You can also add a debounce so the function runs once: texting = [directory to textbox] local MH = game.Players.LocalPlayer.Character.Humanoid.MaxHealth local H = game.Players.LocalPlayer.Character.Humanoid.Health local debounce = false
texting.MouseButton1Down:connect(function() if debounce = false then MH = MH + 150 H = H + 150 debounce = true end)
|
|
|
| Report Abuse |
|
|
|
| 16 Sep 2015 04:46 PM |
Thank's but... why are we adding this?
texting = [directory to textbox]
It causes the script to error up. |
|
|
| Report Abuse |
|
|
|
| 16 Sep 2015 08:41 PM |
For the
texting = [directory to textbox]
part, you are supposed to put the location of the textbox.
For example:
If you have a part inside of a model in Workspace, you would write the directory like this:
part = game.Workspace.Model.Part
For something in the Player's gui, like the button you want to make, it would be more like this:
texting = game.Players.LocalPlayer.PlayerGui.[Fill in the rest] (LocalPlayer only works in a LocalScript, and LocalScripts will only work in the PlayerGui, or in the player's backpack.)
Example:
texting = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextBox
Because I don't know the exact location for your textbox, you will have to figure out exactly what goes after the PlayerGui.
--I can put my waits wherever I want. |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2015 09:12 PM |
Ok so...what goes on is
PlayerGui.ArmorGui.Container.ScrollingFrame.Template
(The script is after that, not sure if i should add it)
So why isn't it working? |
|
|
| Report Abuse |
|
|
|
| 24 Sep 2015 08:59 PM |
The exact location would be:
textbox = game.Players.LocalPlayer.PlayerGui.ArmorGui.Container.ScrollingFrame.Template
Be sure the code is in a LocalScript.
--I can put my waits wherever I want. |
|
|
| Report Abuse |
|
|
galio13
|
  |
| Joined: 20 Jul 2011 |
| Total Posts: 842 |
|
|
| 25 Sep 2015 12:07 AM |
ok I have tested this and this script will do it:
I made a screenGui and a textbutton in that and so a script in the textbutton,
#code
local button = script.Parent button.MouseButton1Down:connect(function() local h = script.Parent.Parent.Parent.Parent.Character.Humanoid h.MaxHealth = 250 end) |
|
|
| Report Abuse |
|
|
|
| 25 Sep 2015 11:39 PM |
I never thought of putting the script in the TextBox... Good thinking Galio, and nice seeing you again. ;)
--I can put my waits wherever I want. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2015 10:23 PM |
I Tried both your idea's but they don't work... At this point in the process i'm going to ask that you take a direct look at my model and tell me if it's ok...i may have screwed something up
MODEL LINK, http://www.roblox.com/GUI-Armor-shop-item?id=301602159
Thank you :) |
|
|
| Report Abuse |
|
|