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

Trouble cloning a ScreenGui from replicated storage to Local PlayerGui?

Asked by 7 years ago

I don't know if this is a clone bug or something, but this has made me very frustrated and makes me less motivated to develop my game. So, what my local script does (filtering is enabled) is that it checks if a certain part in workspace is transparent. If true, it will clone a screen gui to local playergui. Although it works, the gui looks like it gets deleted as soon as it gets cloned, because I can see it appear for a second then disappear right after. Seconds later, it will keep duplicating itself. I don't know whats happening, and its really annoying. Here are the scripts that I think are affecting the Screen GUI

local gui = script.Parent
local frame = gui.Frame
local warning = frame.Warning
warning.ImageTransparency = 1
local alarm = gui.Alarm
local static = frame.Static
local staticsfx = gui.StaticSound
local music = game.Players.LocalPlayer.PlayerGui.Music
local warningscre = workspace.Flowey.TV.TVScreen.Warning
local warningdec = warningscre.Decal
local warningglow = warningscre.Glow.Decal
music:Play()
wait(20)

alarm:Play()
while alarm.Playing do
    wait(0.1)
for i = 1, 0, -0.1 do -- 0.1 should be -0.1
        warning.ImageTransparency = i
        warningscre.Transparency = i
        warningdec.Transparency = i
        warningglow = i
        wait() -- added
    end
for i = 0, 1, 0.1 do
        warning.ImageTransparency = i
        warningscre.Transparency = i
        warningdec.Transparency = i
        warningglow = i
        wait() -- added
    end

end


wait(0.05)
staticsfx:Play()
static.ImageTransparency = 0
wait(1)
target  = CFrame.new(276.1, 69.8, 84.4) -- position
game.Players.LocalPlayer.Character.Torso.CFrame = target
wait(0.12)
static.ImageTransparency = 1
music.SoundId = "rbxassetid://593757238"
music.TimePosition = 0

wait(0.5)
script.Parent:Destroy()

while true do -- it is "while true do" so that it checks every 0.1 seconds.
    wait(0.1)
    if workspace.FirstSoulValue.Transparency == 1 then
        wait(5)
        game.ReplicatedStorage.SoulScripts.Soul2.Warning:Clone().Parent=game.Players.LocalPlayer.PlayerGui
        wait(0.1)
        script:Destroy()
    end
end
0
it might be because you're destroying the script? or because the transparency is still 1? RobloxianDestory 262 — 7y
0
it most likely is the result of destroying the script. he probably made the mistake of trying to destroy the script in the clone, so he assumed that script:Destroy() would destroy it for the clone scottmike0 40 — 7y

Answer this question