I have 2 surface GUIS, And when I aim a gun I want it to be so one appears and one disappears, Let's say the one for when I aim is b will appear and A will disappear, and if I'm not aiming, A will appear and B will disappear,
So i made this script,
if Aiming = false WaitForChild("RHUD") WaitForChild("Ammo) RHUD.Ammo.properties.TextTransparency = 1 ) end if Aiming = true WaitForChild("HUD") WaitForChild("Frame") HUD.Frame.properties.Visible = false )
I might have it all wrong, Im pretty new to LUA, Help is apreachated!
Thanks! James Bread armyofdeath909 “Two possibilities exist: either we are alone in the Universe or we are not. Both are equally terrifying.”
? Arthur C. Clarke
Make the 'Aiming' variable a BoolValue. Instead of changing the variable, manipulate the BoolValue's Value
property.
You should do this because all ValueObjects have the Changed
event. The Changed even fires whenever the specified object's value is changed.
You can use this to do what you want.
local A; --Your first SurfaceGui's Frame local B; --Your second SurfaceGui's Frame local aim = script.Parent; --The value that will change aim.Changed:Connect(function(result) A.Visible = not result; B.Visible = result; end) --result: true --A: false --B: true --To change aim from another script: --script.Parent.Aim.Value = true;