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
cam = game.Workspace.CurrentCamera
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
The errors means you are trying to change the transparency of something that does not have a transparency property.
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"
it was just normal parts and unions inside of a gun tool. they clearly have a transparency property, but it didn’t work.
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.
“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.
The problem is the part called Grip, you have to rename it because roblox thinks it is a Tool property.
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.