I’m trying to change the color of a part but nothing seems to work.
I’ve tried “BrickColor.new”, " Color3.new", and even seen on the Roblox education site but nothing seems to work.
Script:
local ProximityPromptService = game:GetService("ProximityPromptService")
local triggered = game.ReplicatedStorage.Triggered
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
if triggered.Value == false then
triggered.Value = true
script.Parent.Parent.Parent.Ligth.Color.BrickColor = BrickColor.new(0, 255, 0)
wait(5)
script.Parent.Parent.Parent.Ligth.Color.BrickColor = BrickColor.new(255, 0, 0)
wait(2)
triggered.Value = false
end
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)
Error:
BrickColor cannot be assigned to - Server - Script:7
if Ligth is the part then you don’t need to add .Color and BrickColor.new() only works with string colors, instead, use
script.Parent.Parent.Parent.Ligth.BrickColor = BrickColor.new('Grey')
and if you want specific color values use: script.Parent.Parent.Parent.Ligth.Color = Color3.new(0.5,0.5,0.5) --on a scale from 0 to 1
local ProximityPromptService = game:GetService("ProximityPromptService")
local triggered = game.ReplicatedStorage.Triggered
-- Detect when prompt is triggered
local function onPromptTriggered(promptObject, player)
if triggered.Value == false then
triggered.Value = true
script.Parent.Parent.Parent.Ligth.Color= Color3.fromRGB(0, 255, 0)
wait(5)
script.Parent.Parent.Parent.Ligth.Color= Color3.fromRGB(255, 0, 0)
wait(2)
triggered.Value = false
end
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)