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

Variable Cannot Be Assigned To?

I feel like this is easy but I can't get it. Output: 16:22:42.022 - Value cannot be assigned to 16:22:42.023 - Script 'Workspace.Cyan.Portal', Line 22 16:22:42.025 - Stack End

bullet = script.Parent
name = bullet.Name

bullet.Touched:connect(function(hit)
	if hit.Parent.ClassName ~= "Tool" then
		bullet:Destroy()
		if hit.Name == "WhiteWall" then
			if name == "Cyan" then
				for _,v in pairs(workspace.Walls:GetChildren()) do
					if v:FindFirstChild("CyanPortal") then
						v.CyanPortal:Destroy()
						v.CanTeleport.Value = false
						v.Color.Value = "White"
					end
				end
				wait()
				local decal = Instance.new("Decal",hit)
				decal.Texture = "http://www.roblox.com/asset/?id=189212648"
				decal.Face = "Front"
				decal.Name = "CyanPortal"
				hit.CanTeleport.Value = true
				hit.Color.Value = "Cyan"
			elseif name == "Orange" then
				for _,v in pairs(workspace.Walls:GetChildren()) do
					if v:FindFirstChild("OrangePortal") then
						v.OrangePortal:Destroy()
						v.CanTeleport.Value = false
						v.Color.Value = "White"
					end
				end
				wait()
				local decal = Instance.new("Decal",hit)
				decal.Texture = "http://www.roblox.com/asset/?id=189212620"
				decal.Face = "Front"
				decal.Name = "OrangePortal"
				hit.CanTeleport.Value = true
				hit.Color.Value = "Orange"
			end
		end
	end
end)

2 comments

0

Everything exists with the proper name and type.

0

I just noticed also that CanTeleport's value does not get changed either

2 answers

✓ Accepted answer

(This may or may not be the answer)

Okay so.

Hit is a part- right?

So parts don't have colors they have BrickColors

So you'd need to do:

hit.BrickColor = BrickColor.new("Cyan")

2 comments

0

How stupid of me. Color is a stringvalue I put inside the parts. However I shouldn't have named it Color.

0

Click on the "answered" button under my name so it makes a check mark saying I answered it, plus we both get reputation

Replace

hit.Color.Value = "Cyan"

with

hit.Color = Color3.new(0, 255, 255) --Cyan RGB Color Coordinates

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