"Transparency cannot be assigned"

For some reason, my lines of code aren’t turning parts’ transparencies to 1. The output bar says “Transparency cannot be assigned.” Code:

local scoped = false
local cam

script.Parent.Equipped:connect(function(mouse)
cam = game.Workspace.CurrentCamera
mouse.KeyDown:connect(function(key)
key = key:lower()

	if key == "q" then
		cam.FieldOfView = scoped and 70 or 60
		scoped = not scoped
	
		
		
		script.Parent.ADSGun.Transparency = 0
		script.Parent.ADSSights.Transparency = 0
		
		script.Parent.Barrel.Transparency = 1
		script.Parent.BarrelBack.Transparency = 1
		script.Parent.Grip.Transparency = 1
		script.Parent.Mag.Transparency = 1
		script.Parent.Sights.Transparency = 1
		script.Parent.Trigger.Transparency = 1
		script.Parent.FakeBarrel.Transparency = 1

		

		end
end)

end)

2 Likes

The errors means you are trying to change the transparency of something that does not have a transparency property.

Example
You can Change the Transparency of a part

Part.Transparency = 1--Will Work

You cannot change the Transparency of other objects that do not have a Transparency Property, Ex.StringValue

StringValue.Transparency = 1--Will error “Transparency cannot be assigned to String Value"
5 Likes

it was just normal parts and unions inside of a gun tool. they clearly have a transparency property, but it didn’t work.

2 Likes

Sometimes scripting can be weird, but just don’t use the string value and just straight away change the transparency value to the part manually.

2 Likes

“The errors means you are trying to change the transparency of something that does not have a transparency property.”

Correct me if I am wrong, but I think that “Property cannot be assigned” means the Object has the following property. But that property, in this case, Transparency cannot be changed through scripts.

2 Likes

The problem is the part called Grip, you have to rename it because roblox thinks it is a Tool property.

6 Likes

if i rename the grip, will the other parts’ transparencies start to go to 1?

Yes, the part called grip is the problem, the rest is fine, I could move the animation within the script, but that is already my opinion, it is not necessary.