How do I make a light using this wires, I made a wire system
If wires touch each other the volts move along
If 2 wires stick to each other, then voltage will be divided into 2 and each get equal voltage
Wire script:
local startingbrickcolor = script.Parent.BrickColor
script.Parent.Volt.Changed:Connect(function()
local partstouching = script.Parent:GetTouchingParts()
if script.Parent.Volt.Value >= 1 and #partstouching ~= 0 then
script.Parent.BrickColor = BrickColor.new("Bright blue")
if #partstouching >= 1 and partstouching[1]:IsA("Part") then
local voltstogive = script.Parent.Volt.Value/#partstouching
for i,v in pairs(partstouching) do
if v:IsA("Part") and v.Name == "Wire" then
v.Volt.Value = voltstogive
end
end
end
wait(0.15)
script.Parent.Volt.Value = 0
script.Parent.BrickColor = startingbrickcolor
end
end)
Now I want to make a light, if it gets the volts or if a wire is touching it and in it the volt is changed, how do I make a light?