ROBLOX Studio LUA: Проблема с клонированием кадра скриптом - PullRequest
0 голосов
/ 03 августа 2020

Я сделал телевизор в ROBLOX Studio со всеми функциями, которые повторяют функцию телевизора в реальной жизни. Столкнулся с проблемой смены телеканалов, проблема в том, что скрипт скопированного канала (кадра) не работает синхронно с каналом, который находится в передатчике. Расписание канала: в 10 часов утра показывают регистрацию канала, через 20 секунд показывают изображения, эт c. 10 секунд a go, передатчик уже начал загружать картинки в канал (скрипты внутри) вместо заставки входа, которая всегда появляется на телевизоре, если вы включаете телевизор или меняете канал после начала трансляции.

Загрузка канала

function TVChannelLOAD()
if debouncechannelvideochange == false then
    if tvoutput == 0 and debounce == true then
        if game.Workspace:FindFirstChild("tvStudio".. tostring(channel)) ~= nil then
            local chan = game.Workspace:FindFirstChild("tvStudio".. tostring(channel)).tvtransmitter.main.channel:Clone()
            chan.Parent = gui.Screen.TV
        end
    end
end
outputname()
end

Смена канала (кнопки + -)

function channelpl(plr)
if tostring(plr) == member then
    if debounce == true then
        if tvoutput == 0 and debouncechannelvideochange == false then
            debouncechannelvideochange = true
            glass.Transparency = 0
            tvscreen.Light.Brightness = 0
            tvscreen.Light.Enabled = false
            if tostring(gui.Screen.TV:FindFirstChild("channel")) == "channel" then
                gui.Screen.TV:FindFirstChild("channel"):Destroy()
            end
            channel = channel + 1
            if channel > 99 then
                channel = 1
            end
            wait(1)
            glass.Transparency = 0.8
            tvscreen.Light.Brightness = 0.8
            debouncechannelvideochange = false
            tvscreen.Light.Enabled = true
            TVChannelLOAD()
        end
    end
end
end



function channelmin(plr)
if tostring(plr) == member then
    if debounce == true then
        if tvoutput == 0 and debouncechannelvideochange == false then
            glass.Transparency = 0.0
            tvscreen.Light.Brightness = 0.0
            debouncechannelvideochange = true
            tvscreen.Light.Enabled = false
            if tostring(gui.Screen.TV:FindFirstChild("channel")) == "channel" then
                gui.Screen.TV:FindFirstChild("channel"):Destroy()
            end
            channel = channel - 1
            if channel <= 0 then
                channel = 99
            end
            wait(1)
            glass.Transparency = 0.8
            tvscreen.Light.Brightness = 0.8
            debouncechannelvideochange = false
            tvscreen.Light.Enabled = true
            TVChannelLOAD()
        end
    end
end
end

Пример скрипта канала

function intro()
if game.Lighting.ClockTime <= broadcastend and game.Lighting.ClockTime >= broadcaststart then
    if tostring(script.Parent.Parent.Name) == "main" then
        local sound = script.Parent.Parent:FindFirstChild("channels")
        sound.SoundId = intromusicID
        sound:Play()
    end
    script.Parent.Time.Visible = false
    text5.Position = UDim2.new(0.125, 0, 0.5, 0)
    text5.TextTransparency = 1
    backgroundintro.Visible = true
    decal.Visible = false
    wait(5)
    if game.Lighting.ClockTime >= broadcaststart and game.Lighting.ClockTime <= 14 then
        text1.Text = "10:20 - 1"
        text2.Text = "11:30 - 2"
        text3.Text = "12:20 - 3"
        text4.Text = "13:20 - End of broadcast day"
        text5.Text = " "
    end
    backgroundintro.logo:TweenPosition(UDim2.new(0, 10, 0, 10))
    backgroundintro.logo:TweenSize(UDim2.new(1, -700, 1, -525))
    wait(2)
    for i = 1, 0, -0.1 do -- wait(1)
        text1.TextTransparency = i
        text2.TextTransparency = i
        text3.TextTransparency = i
        text4.TextTransparency = i
        text5.TextTransparency = i
        wait(0.1)
    end
    wait(12)
    backgroundintro.logo:TweenPosition(UDim2.new(1, -475, 1, -350))
    backgroundintro.logo:TweenSize(UDim2.new(1, -650, 1, -500))
    for l = 0, 1, 0.1 do -- wait(1)
        text1.TextTransparency = l
        text2.TextTransparency = l
        text3.TextTransparency = l
        text4.TextTransparency = l
        text5.TextTransparency = l
        wait(0.1)
    end
    if tostring(script.Parent.Parent.Name) == "main" then
        local sound = script.Parent.Parent:FindFirstChild("channels")
        sound:Stop()
    end
    backgroundintro.Visible = false
else
    backgroundintro.Visible = true
    text5.Position = UDim2.new(0.125, 0, 0, 0)
    text5.TextTransparency = 0
    script.Parent.Time.Visible = true
    text5.Text = "Broadcast starts at 10 am. Thanks for watching"
end
end

while true do
intro()
if game.Lighting.ClockTime >= broadcaststart and game.Lighting.ClockTime <= broadcastend then
    decal.Visible = true
    one()
    two()
    three()
    decal.Visible = false
end
wait(0.1)
end
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...