Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Lets say i have 2 surface GUIS....?

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

1 comment

0

Please spell it as Lua, not LUA. http://acronyms.thefreedictionary.com/lua

1 answer

✓ Accepted answer

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;

2 comments

1

Thanks! Its worked flawlessly!

0

No problem ;D

This discussion is preserved as it was. New answers, comments, and votes are closed.