How to make a light using wire blocks

image

Now, this is a wire system


How do I fix the light which works from it

The script:

local startingmaterial = script.Parent.Material
wait(15)

local touchparts = script.Parent:GetTouchingParts()
for i,v in pairs(touchparts) do
    if v:IsA("Part") and v.Name == "Wire" then
        v.Volt.Changed:Connect(function()
            if v.Volt.Value >= 1 then
                script.Parent.Material = Enum.Material.Neon
                wait(1)
                script.Parent.Material = startingmaterial
            end
        end)
    end
end

So the light checks if any wire is touching and in the wire there is an IntValue called volts and thats how much the wire is having, so the light should work for a particular number of volts and should work, the script I made dosen’t work, please tell how to fix it

I am making a game like bloxburg where you need to do things like in irl to run a house

So I need this to be fixed please tell how to fix

But the error, I don’t know how to fix

1 Like

welp, ok lets wait for someone to answer maybe they know how to fix

do if v:IsA(“BasePart”) instead, part works only for parts, but BasePart works with meshparts and unions

1 Like

I think a solution has been found

1 Like

The wire connected to light broke, it dosen’t turn blue after it gets current after removing light the wire works, does this mean wire works for wires only?

Parent Volt To The Light Build

local Bulb = -- Bulb Directory
if Bulb.Volt.Value == --[[ amount ]] then
  Bulb.Material = "Neon"
  wait(2)
  Bulb.Material = "Plastic"
end

This Is For Turning ONLY Bulb On For More Tell Me Oh nice it was solution yayay

robloxapp-20210826-1817276.wmv (317.9 KB)

If you would like, I can send the wire and light scripts and this is how it works

Thank you! I really appreciate it!

1 Like