ReplicatedFirst:RemoveDefaultLoadingScreen()在Studio中未触发

问题描述 投票:1回答:1

我又遇到另一个问题。我正在尝试为游戏创建自定义加载屏幕,但是RemoveDefaultLoadingScreen似乎没有触发。谁能帮我这个?这是我的代码:

local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
ReplicatedFirst:RemoveDefaultLoadingScreen()
local TweenService = game:GetService("TweenService")
local Player = Players.LocalPlayer 
local PlayerGui = Player:WaitForChild("PlayerGui")
PlayerGui:SetTopbarTransparency(1)
local Loading = ReplicatedFirst.Load
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.IgnoreGuiInset=true
local Bar = Loading.Frame.TextLabel
ScreenGui.Name = "LoadScreen"
Loading.Parent = ScreenGui
ScreenGui.Parent = PlayerGui
local Info = TweenInfo.new(0.7,Enum.EasingStyle.Cubic,Enum.EasingDirection.InOut,0,true,0)
local Tween = TweenService:Create(Bar,Info,{Position=UDim2.new(0.8,0,0.6,0)})
spawn(function()
    while true do
        Tween:Play()
        Tween.Completed:Wait()
    end
end)
if not game:IsLoaded() then
    game.Loaded:Wait()
end
for i=0,1,0.1 do
    Loading.BackgroundTransparency=i
    Bar.TextTransparency=i
    Loading.Frame.Load.TextTransparency=i
    wait()
end
ScreenGui:Destroy()

一切正常,但第三行在Studio中不起作用。应该是这样吗?帮助将不胜感激。

lua roblox
1个回答
2
投票

我测试过,它在Roblox Studio中可以正常工作。不过请注意:

在工作室中,加载屏幕几乎立即消失,因此您不会看到太大的区别。

我将wait(5)放在脚本中的if not game:IsLoaded() then行之前,这将模拟5秒钟的加载。然后,您可以在有[c0]命令与不存在ReplicatedFirst:RemoveDefaultLoadingScreen()命令的情况下玩,然后您会看到其中的区别。

© www.soinside.com 2019 - 2024. All rights reserved.