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

Changing brick color does not work in non-experimental mode?

I made a coffee script to change the name of the cup and the color and transparency of an invisible brick when it is touched to a certain machine. This worked fine until I realized I built it in experimental mode, when I changed it the script no longer worked. It works in studio but not in the actual game. The script is a normal script and not a local script if that helps. I don't get any errors either, I've tried looking at the pages for converting experimental to non-experimental for hours, trying remote events and functions, none of it worked. For some reason, the naming script works but not the brick color or transparency one. Here's an example script for the milk-steamer:

function makeLatte(cup)
	if cup.Parent.Name == "Espresso" then
		cup.Parent.Name = "Latte"
		cup.Parent.Drinkk.BrickColor = script.LatteColor.Value
	cup.Parent.Drinkk.Transparency = 0
	end
	if cup.Parent.Name == "EmptyCup" then
		cup.Parent.Name = "SteamedMilk"
		cup.Parent.Drinkk.BrickColor = script.MilkColor.Value
	cup.Parent.Drinkk.Transparency = 0
	end
	if cup.Parent.Name == "Chocolate Syrup" then
		cup.Parent.Name = "Hot Chocolate"
	cup.Parent.Drinkk.BrickColor = script.LatteColor.Value
	cup.Parent.Drinkk.Transparency = 0
	end
	if cup.Parent.Name == "Chocolate Espresso" then
		cup.Parent.Name = "Mocha"
	cup.Parent.Drinkk.BrickColor = script.MochaColor.Value
	cup.Parent.Drinkk.Transparency = 0
	end
end
script.Parent.Touched:Connect(makeLatte)

Any help is appreciated!

8 comments

0

Is the script getting destroyed before you make a latte? Is the script being disabled?

0

Nope, the naming script works still but not the brick color/transparency one for some reason.

0

Are LatteColor, MilkColor, and MochaColor BrickColorValue's?

0

Yep, they are.

0

Add calls to the print function At the top of the function (inside it) add a call to print, something like print("Touched") and inside your if statements, to make sure the code is actually running.

0

add a print to the first line in the function then add more inside the if statements. Btw you can use elseif instead of having to create another if statement. I'll edit my answer so you'll see what I mean.

0

Btw, include any code that changes the "cup" name.

0

Thanks awesome, it prints and I don't get any errors, but the brick inside only changes color and transparency in studio, not the game itself. I don't know if it's an issue with server/client information but I don't think I should need to use remote events/functions for this? I'm not sure though.

1 answer

Change values to the colors name then add BrickColor.new() and place the value inside the parenthesis:

cup.Parent.Drinkk.BrickColor = BrickColor.new(script.LatteColor.Value)

Edit:

function makeLatte(cup)
	print("makeLatte function fired")

	if cup.Parent.Name == "Espresso" then
		print("Espresso")
		cup.Parent.Name = "Latte"
		cup.Parent.Drinkk.BrickColor = script.LatteColor.Value
		cup.Parent.Drinkk.Transparency = 0
--end
	elseif cup.Parent.Name == "EmptyCup" then
		print("EmptyCup")
		cup.Parent.Name = "SteamedMilk"
		cup.Parent.Drinkk.BrickColor = script.MilkColor.Value
		cup.Parent.Drinkk.Transparency = 0
--end
	elseif cup.Parent.Name == "Chocolate Syrup" then
		print("Chocolate Syrup")
		cup.Parent.Name = "Hot Chocolate"
		cup.Parent.Drinkk.BrickColor = script.LatteColor.Value
		cup.Parent.Drinkk.Transparency = 0
--end
	elseif cup.Parent.Name == "Chocolate Espresso" then
		print("Chocolate Espresso")
		cup.Parent.Name = "Mocha"
		cup.Parent.Drinkk.BrickColor = script.MochaColor.Value
		cup.Parent.Drinkk.Transparency = 0
	end
end
script.Parent.Touched:Connect(makeLatte)

2 comments

0

It still doesn't work. I'm not sure what I'm doing wrong, but for some reason the script works in studio and not the actual game. If the place is in experimental mode it works though. No idea what's wrong.

0

Thanks for the edit! Small problem still, it works in studio but not Roblox itself. I don't know why, the naming script works but not 'Drinkk' color script. Extra info just in case it will help: Drinkk is (probably obviously) a transparent object inside the cup that's supposed to change color and transparency when touched to a certain machine, and it only works in studio right now.

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