(the script is for changing the name and color of the patty tool when it goes on top of the oven)
The name of the patty changes but not the color. I’ve been trying to make the color changing part of the script work for a while and this is what I have currently. I don’t really know how to script well yet so I don’t know what to do.
script.Parent.Touched:Connect(function (h)
if h.Parent.Name == "Raw Patty" then
wait(5)
h.Parent.Name = "Cooked Patty"
end
if h.Parent.Name== "Cooked Patty" then
wait(0)
h.Parent.BrickColor = BrickColor.new(95,64,50)
end
end)
Not sure what you mean by I’ve been trying to make the color changing part do you want the part to be color changing as in RGB? or just changing the part to black or white?
local part = script.Parent
local click = part.ClickDetector
local function pickup(player)
local newTool = Instance.new('Tool')
newTool.Name = 'Raw Patty'
local handle = part:Clone()
handle.Name = 'Handle'
handle.Parent = newTool
handle.Script:Destroy()
newTool.Parent = game.Workspace[player.Name]
end
click.MouseClick:Connect(pickup)
p.s. I’ve just realized the issue is probably the fact that I’m trying to change the color of a tool (not sure if that’s possible or not)
Probably like that, Color/BrickColor can be only changed on union, part, etc.
When you touched something, It will return the part, so you can change the color of h without going to Its parent.
So this script should work.
script.Parent.Touched:Connect(function (h)
if h.Parent.Name == "Raw Patty" then
wait(5)
h.Parent.Name = "Cooked Patty"
h.Color = Color3.fromRGB(95,64,50) --color should change too since it's changes to "cooked patty"
end
--[[
if h.Parent.Name== "Cooked Patty" then
wait(0)
h.Color = Color3.fromRGB(95,64,50) --change color instead of brickcolor
end
]] -- the color already change with the name on statement one so it doesn't need to change again
-- but you can add it back in case it doesn't work
end)
local Part = script.Parent
Part.Touched:Connect(function(Hit)
if Hit.Name == "Raw Patty" then
task.wait(5)
Hit.Name = "Cooked Patty"
Hit.BrickColor = BrickColor.new("Earth orange")
end
end)
The Color3 value you specified is closest to the “Earth orange” BrickColor value.
Few questions which may answer yours. Firstly, is the “h.Parent” a model? If so, you can’t change the colour of a model so you might’ve overlooked that. Secondly, try h.Parent.Color = Color3.new(–RGBVALUE) as brickcolor takes in a string to change the colour, other than that I don’t see anything wrong with the script
TL;DR
Issue1: h.Parent could be a model which if so, you can’t change the colour of that. Same for if it’s a tool
Issue2: h.Parent.BrickColor takes in a string value, use h.Parent.Color = Color3.new(95, 64, 50) instead
Sorry for answering late, I haven’t been on my computer in a few days.
I’m going to try replacing the raw patty tool with a cooked patty tool instead of changing the name and color