gun atachments script

hey i am trying to make a script where it just enables and disables certain child object of the gun
for example i want it to be like
if i have the flashlight atached to the gun then the flashlight object should appear
to atach the flashlight it should be when i press the GUI button or when a variable is = true (for item pickup)

what i have till now is this

anyone knows what the error is?

Depends. What error do you get?¨

it says that thigs that are right are wrong…
like for example
function SwitchAtachment(index : int)
it says that the “:” should be “(”

Is the spaces in the names a copy paste error or an actually issue in your script?

where?

transform.GetChild(flashlight).gameObject.SetActiv eRecursively(false); ← right there. SetActiv:face_with_spiral_eyes:eRecursively(false);

ohh i think you solved my problem im gonna test it ty

nope its just a copy paste error