- What do you want to achieve?
So for my game when you first join there’s an introduction scene of loading assets, etc. I only want this to show up when you join the game for the first time. My current idea is having a PlayerAdded connect function that gives the player an Introduction scene script that gets placed in their PlayerGui.
For context, the Introduction script changes their camera, tweens out/in the menu buttons, etc.
- What is the issue?
When you reset your character, the intro script isn’t there to tween in the UI buttons/make them visible. I could turn off reset but that’s been proven unreliable sometimes. (sometimes it errors, sometimes it does nothing, there isn’t a check that checks if it’s enabled or disabled.)
- What solutions have you thought of so far?
My current solution so far is putting the intro script and the client script (the script that handles opening the UI frames, etc) together. The issue with this is that I feel like it could have cons. What if a player resets before the intro is done? I don’t even know what the error would do.
2 Likes
Did you test it first? Maybe it will work. (idk im not much of a scripter)
Yeah I did test it, it works but I’ve been in countless games that you aren’t allowed to reset in (SCP games mostly) and sometimes players are just resetting left and right because of a Roblox error not disabling it.
The best way to do this is actually to make the intro GUI with a LocalScript in ReplicatedFirst
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local LocalPlayer = game:GetService("Players").LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local TweenService = game:GetService("TweenService")
local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
textLabel.Font = Enum.Font.GothamSemibold
textLabel.TextColor3 = Color3.fromRGB(255,255,255)
textLabel.Text = "Loading"
textLabel.TextSize = 28
textLabel.Parent = screenGui
local loadingRing = Instance.new("ImageLabel")
loadingRing.Size = UDim2.new(0, 64, 0, 64)
loadingRing.BackgroundTransparency = 1
loadingRing.Image = "rbxassetid://4965945816"
loadingRing.AnchorPoint = Vector2.new(0.5, 0.4)
loadingRing.Position = UDim2.new(0.5, 0, 0.4, 0)
loadingRing.Parent = screenGui
screenGui.Parent = PlayerGui
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local tween = TweenService:Create(loadingRing, tweenInfo, {Rotation=360})
tween:Play()
ReplicatedFirst:RemoveDefaultLoadingScreen()
wait(2) -- Display the loading screen for at least a specified amount of time. remove if you want the loading screen to be removed immediately when the game loads.
if not game:IsLoaded() then
game.Loaded:Wait()
end
screenGui:Destroy()
Since the GUI is destroyed, it won’t reappear if the player resets.
Do local scripts automatically run if they’re in ReplicatedFirst?
Anything in a Script or LocalScript should run automatically if it is not wrapped in a function and the script is not in Lighting or ServerStorage. So yes, it would run automatically in ReplicatedFirst