|
| 06 Apr 2015 01:09 AM |
I have a script that does some stuff on key down. I also have a value called "Energy" located at PlayerGui.BU7Stats.CharStats.Energy. The objective is to have the script activate when if the key is pressed AND the energy value is greater than the required amount of "Energy". How can I do this?
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local char = player.Character
function onkey(key) if key == "z" then char.BTorso.ForceController.BodyThrust.location = Vector3.new(0,0,-100) wait() char.BTorso.ForceController.BodyThrust.force = Vector3.new(0,0,98000) wait() char.BLArm.ShieldPart.Transparency = 0.2 wait() char.BTorso.DragonSoul.Transparency = 0.75 wait() char.BTorso.TorsoMain.Fire.Enabled = true wait(1.5) char.BTorso.ForceController.BodyThrust.location = Vector3.new(0,0,0) wait() char.BTorso.ForceController.BodyThrust.force = Vector3.new(0,0,0) wait() char.BLArm.ShieldPart.Transparency = 1 wait() char.BTorso.DragonSoul.Transparency = 1 wait() char.BTorso.TorsoMain.Fire.Enabled = false print("Test Succesfull") end end
mouse.KeyDown:connect(onkey) |
|
|
| Report Abuse |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 06 Apr 2015 03:07 AM |
| if key == 'z' and Energy > req then |
|
|
| Report Abuse |
|
|
| 08 Apr 2015 12:51 PM |
| Output now says CNOStats is not a member of PlayerGui. |
|
|
| Report Abuse |
|