Problem with changing colors and material of an object

Hello, its me again Immebest. So well I am really new scripter and now trying to make certain meshes/objects change color and material if a certain value goes above a certain number.

Although it did not worked, I tried everything from making sure I saved the scripted, comitted them and rewrite and try to fix it lots of times but the material color or the material itself never changed, this is the script I was using and I would be thankful if someone told me what was wrong.

local Temp = workspace.Temp
if Temp.Value >= 3000 then
script.parent.brickcolor = "New Yeller"
script.parent.material = "Neon"
local Temp = game.Workspace.Temp
if Temp.Value >= 3000 then
script.Parent.BrickColor.new(255, 255, 0)
script.Parent.Material = "Neon"

your errors was “script.parent” use “script.Parent” instead and also you used “brickcolor” and “material” use “BrickColor” and “Material” instead , also here is where you can study about BrickColors! BrickColor | Roblox Creator Documentation

From what it looks like to me, you’re only trying to change the Properties once when the script starts.

You need to either periodically change it with a loop such as while wait(5) do or using RunService
or you can detect when the Value has changed, then update it with temp.Changed:Connect(function()..

a quick script:

local temp = workspace.Temp
temp.Changed:Connect(function()
 if temp.Value >= 3000 then
        script.Parent.BrickColor = BrickColor.new("New Yeller")
        script.Parent.Material = Enum.Material.Neon
    end
end)

I’m pretty sure ROBLOX will allow

  • script.parent
  • script.parent.brickcolor
  • script.parent.material

I may be wrong since I’m just used to typing them with the correct spelling, but I’ve seen code with no capitalization and they’ve worked fine.

Is this the entire code? Are there any errors? There would be an error if this was the entire code.

Thats great and all, but well I still cant change the color it just stays like that and I am so sure that I commited this script and followed your instructions but it still doesnt work. I just want a script that just changes the color once.

Its really just the entire code, there is nothing else its just blank and simple as that.

Instead of directly writing the raw form of the values, I’d rather do this.

script.Parent.BrickColor = BrickColor.new("New Yeller")
script.Parent.Material = Enum.Material.Neon

Oh I’m sorry, I’d forgotten to mention you’re writing the BrickColor wrong.

You can either use BrickColor.Red, Blue, Green, etc.
But for a specific color like New Yeller you need to use script.Parent.BrickColor = BrickColor.new("New Yeller")

And for Material: script.Parent.Material = Enum.Material.Neon

Oh, thank you very much I will sure try that.

Ah. You would have to end and if statement with end
Like this

if <statement> then
    -- Do stuff
end 

Also you might want to use an event to check the value every time it changes

temp.Changed:Connect(function(property)
    if temp.Value > 3000 then
        script.Parent.BrickColor = BrickColor.new()-- Hopefully you get the idea.
   end
end)

AArrgghh someone commented before lol.