Ok so, i hate working with childrens functions, i don't know why it doesn't work. I'm trying to make these beep blocks from Mario Galaxy.
(If you don't know how these blocks work, you should check this video https://youtu.be/EN4X7x4w65Q?t=3m9s)
But with this script, the blocks just do nothing at all.
Please, i need some help!
local g = script.Parent.Green
local o = script.Parent.Orange
local sound1 = script.Parent.Sound1
local sound2 = script.Parent.Sound2
function gr()
if gr == true then
script.Parent.Sound1:Play()
for _, child in pairs(g:GetChildren()) do
child.Reflectance = 0.4
wait(0.1)
child.Reflectance = 0
end
gr = false
end
end
function gf()
if gf == true then
script.Parent.Sound2:Play()
for _, child in pairs(g:GetChildren()) do
child.Transparency = 1
child.CanCollide = false
end
for _, child in pairs(o:GetChildren()) do
child.Transparency = 0
child.CanCollide = true
end
gf = false
end
end
function ore()
if ore == true then
script.Parent.Sound1:Play()
for _, child in pairs(o:GetChildren()) do
child.Reflectance = 0.4
wait(0.1)
child.Reflectance = 0
end
ore = false
end
end
function of()
if of == true then
script.Parent.Sound2:Play()
for _, child in pairs(o:GetChildren()) do
child.Transparency = 1
child.CanCollide = false
end
for _, child in pairs(g:GetChildren()) do
child.Transparency = 0
child.CanCollide = true
end
of = false
end
end
while true do
wait(1.5)
gr = true
wait(0.7)
gr = true
wait(0.7)
gr = true
wait(0.7)
gf = true
wait(1.5)
ore = true
wait(0.7)
ore = true
wait(0.7)
ore = true
wait(0.7)
of = true
end

2 comments
You have nothing to run the function the if statement is not checking constantly. You would need to place the if statement inside of a loop.
I updated my answer again.