Hello, I’m DragonDarkVader! Also known as one of the Developers of Sage. Some of the Developers are having trouble fixing this problem which is to avoid Player Movement when the loading screen is still Visible…
INSIDE THE MODEL
RESULT OF THE MODEL
So the problem is, we want to disable the player movement when the UI is still showing…But everytime i try to do something about it, It doesn’t work.
VIDEO FUNCTIONS
robloxapp-20221223-1722474.wmv (1.1 MB)
THE CODE INSIDE THE MODEL
-- I've combined them into 1 LocalScript, so this is the full script here!
local camera = workspace.CurrentCamera -- We're placing the player's camera as a variable.
local cameraCFrame = Vector3.new(785.252502, 26.7999554, -367.648529)
local cameraFocus = Vector3.new(784.095642, 26.3445187, -366.081909)
local introUI = script.Parent -- Defining the text objects
local playButton = introUI.PlayButton
local creditButton = introUI.CreditButton
local shopButton = introUI.ShopButton
local inventoryButton = introUI.InventoryButton
local TweenService = game:GetService("TweenService") -- This tween stuff will apply to scripting the play button!
local tweeningInfo = TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0)
local function hoverEffect(object) -- Make function for it to move a bit.
local originalPosition = object.Position
object.MouseEnter:Connect(function()
object:TweenPosition((originalPosition + UDim2.new(.015, 0, 0, 0)), "Out", "Sine", .1, true)
end)
object.MouseLeave:Connect(function()
object:TweenPosition((originalPosition), "Out", "Sine", .1, true)
end)
end
-- This part helps apply the hover effect scripted onto the button!
hoverEffect(playButton)
hoverEffect(creditButton)
hoverEffect(shopButton)
hoverEffect(inventoryButton)
--Time to script the play portion!
playButton.MouseButton1Click:Connect(function()
local fading = introUI.FadeScreen --This is my frame that was transparent.
local fadeTweenOpaque = TweenService:Create(fading, tweeningInfo, {BackgroundTransparency = 0})
local fadeTweenTransparent = TweenService:Create(fading, tweeningInfo, {BackgroundTransparency = 1})
fadeTweenOpaque :Play()
wait(10) -- Abitrary number, change to what you wish.
camera.CameraType = Enum.CameraType.Custom -- Change the camera back to player control.
for _, object in pairs(introUI:GetChildren()) do -- We're gonna delete everything, but the fading part, as we don't need them anymore (for this tutorial)
if object ~= fading then
object:Destroy()
end
end
fadeTweenTransparent:Play()
end)
workspace:WaitForChild(tostring(camera)) -- Our camera stuff from before
wait(.1)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(cameraCFrame, cameraFocus)
BTW, THIS MODEL ISN’T MINE NOR THE DEVELOPERS
This model is made by @Lugical
CREDITS TO YOU, THE TEAM IS REALLY GRATEFULL.