I want to freeze the player on start do some checks and then unfreeze them. I grabbed the loading screen script from the wiki and inserted my code to disable the Control module.
The problem is that that it does not always run. When it does my other code runs and enables player movement. I think it has to to do with placement or some kind of check I need but I am not sure.
This is the code I am using:
local PlayerGui = game.Players.LocalPlayer:WaitForChild(“PlayerGui”)
PlayerGui:SetTopbarTransparency(0)
local screen = Instance.new(“ScreenGui”)
screen.Parent = PlayerGui
local textLabel = Instance.new(“TextLabel”)
textLabel.Text = “Loading”
textLabel.Size = UDim2.new(1,0,1,0)
textLabel.FontSize = Enum.FontSize.Size14
textLabel.Parent = screen
local masterControl = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild(“PlayerModule”):WaitForChild(“ControlModule”)) --freeze player
masterControl:Disable() – stop player movement
script.Parent:RemoveDefaultLoadingScreen()
local count = 0
local start = tick()
while tick() - start < 6 do
textLabel.Text = “Loading " … string.rep(”.",count)
count = (count + 1)
wait(.3)
end
screen.Parent = nil