Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script Doesnt Change GUI's Transparency?

Asked by 1 year ago

so this is a day and night script, when the music stops the transparency of the frame changes (or is supposed to change) but it doesn't, can anyone help?

local Lighting = game:GetService("Lighting")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local daySettings = ReplicatedStorage.Daytime:GetChildren()
local nightSettings = ReplicatedStorage.Nighttime:GetChildren()
local LightingChildren = game:GetService("Lighting"):GetChildren()
local fadeGui = game.StarterGui.ScreenGui.Frame

local function setParent(children, parent) -- Using a function is just for convenience so you wouldn't have to use multiple for loops to do the same thing.
    for _, child in ipairs(children) do -- The underscore means we won't be using the index position.
        child.Parent = parent
    end
end

while true do

    script.Day:Play()
    wait(378.346)
    script.Day:Stop()
    fadeGui.Transparency = 0.5
    wait(0.1)
    fadeGui.Transparency = 0
    wait(0.1)

    wait(1)

    setParent(LightingChildren, ReplicatedStorage.Daytime)
    setParent(nightSettings, Lighting)
    Lighting.Brightness = 0.5
    Lighting.GeographicLatitude = -16.816
    Lighting.TimeOfDay = 15.085
    wait(1)


    fadeGui.Transparency = 0.5
    wait(0.1)
    fadeGui.Transparency = 1
    wait(0.1)

    script.Night:Play()
    wait(257.291)
    script.Night:Stop()
    fadeGui.Transparency = 0.5
    wait(0.1)
    fadeGui.Transparency = 0
    wait(0.1)

    wait(1)
    setParent(LightingChildren, ReplicatedStorage.Nighttime)
    setParent(daySettings, Lighting)
    Lighting.Brightness = 3
    Lighting.GeographicLatitude = 0
    Lighting.TimeOfDay = 14.5
    wait(1)

    fadeGui.Transparency = 0.5
    wait(0.1)
    fadeGui.Transparency = 1
    wait(0.1)
end
0
You need to get the GUI from the PlayerGui located inside the player object. The StarterGui is only a container that holds the GUI elements until a player joins the game; then, it replicates everything inside of the StarterGui into the player's PlayerGui when they join the game. xInfinityBear 1777 — 1y

Answer this question