Is this possible?

  1. What do you want to achieve? Change boolean value depending on script.

  2. What is the issue? Can’t seem to figure it out.

  3. What solutions have you tried so far? This is probably a new technique so there aren’t many new solutions i presume?
    Here is what i’m trying to achieve.

if script.Parent.Parent.Parent.WobbleCamera.Disabled == false then -- script is NOT disable which means the boolean should be true 
CamBobble = true;
elseif script.Parent.Parent.Parent.WobbleCamera.Disabled == true then -- script is disabled which means the boolean should be false
CamBobble = false;
1 Like

yeah its possible i think what does output say?

Anything erroring in the Output window?
Try print(script.Parent.Parent.Parent.WobbleCamera.Disabled) before the first line to see what the boolean should be.

No errors in output but in script instead.
image
The unknown global error never existed until i added this change.

You could just do

local ScriptDisabled = script.Parent.Parent.Parent.WobbleCamera.Disabled
CamBobble = not ScriptDisabled

boolean logic is your friend!

1 Like

its a spelling mistake when you declared cambobble you put canbobble?

do local canbobble and there is a spelling mistake, cambobble = true line

CanBobble and CamBobble are completely different things.
CanBobble is only triggered when holding a tool in first person
CamBobble is universal cam bobbing.

1 Like

That is the problem you never defined CamBobble

alright, sorry for my previous posts but I think I understand the problem now
you’re trying to define an if statement inside of a table, you generally shouldnt do this
if you have to something is wrong with the way you structured the code

just define the variable outside the table and you’ll do fine

1 Like

CamBobble is never defined.
You could also simplify to not include the if statement.

local GeneralSettings = {
	CanSwing = true;
	CanBobble = true;
	CanAim = true;
	CanRecoil = true;
	CamBobble = not script.Parent.Parent.Parent.WobbleCamera.Disabled;
	FpsCam = true;
}

-- print(GeneralSettings.CamBobble) - Should return the value of CamBobble
2 Likes

The solution regarding the roblox new variables was enough for me thanks!
This is what i did

CamBobble = if playergui.WobbleCamera.Disabled == true then false else true;
1 Like