i got a loading screen script where im trying to disable all player controls so the player will not be able to move or press other keys that open other stuff.
i’d like to get someones help on this.
local ModuleScript = script.Parent.Parent.Parent.Settings
local Settings = require(ModuleScript)
script.Parent.Parent.Visible = true
script.Parent.Visible = true
local ContentProvider = game:GetService("ContentProvider")
local AssetFolder = Settings.LoadingScreen.AssetFolder:GetDescendants()
local TweenService = game:GetService("TweenService")
local LoadingBarTweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
if Settings.LoadingScreen.LoadingBar == true then
script.Parent.LoadingBar.Visible = true
else
script.Parent.LoadingBar.Visible = false
end
if Settings.LoadingScreen.RandomizedTextEnabled == true then
script.Parent.RandomizedText.Visible = true
else
script.Parent.RandomizedText.Visible = false
end
if Settings.LoadingScreen.DefaultRobloxUI == true then
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
else
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
end
script.Parent.Elements.Background.Image = Settings.LoadingScreen.BackgroundImage
script.Parent.Elements.TopText.Text = Settings.LoadingScreen.TopText
script.Parent.Elements.BottomText.Text = Settings.LoadingScreen.BottomText
local LoadAssets = #AssetFolder
for i, v in pairs(AssetFolder) do
ContentProvider:PreloadAsync({v})
TweenService:Create(script.Parent.LoadingBar.LoadingBar, LoadingBarTweenInfo, {Size = UDim2.new(i/LoadAssets,0,1,0)}):Play()
end
local GradientTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
TweenService:Create(script.Parent.Parent.UIGradient, GradientTweenInfo, {Offset = Vector2.new(-1,0)}):Play()
print("Assets loaded.")
wait(1)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
script.Parent.Visible = false
script.Parent.Parent.UIGradient:Destroy()
script.Parent.Parent.Parent:Destroy()
Using this will do the exact same thing, as disabling controls.
You could try:
-- Some code used from the quoted post.
ContextActionService:BindAction(
FREEZE_ACTION,
function() return Enum.ContextActionResult.Sink end,
false,
unpack(Enum.PlayerActions:GetEnumItems())
)
-- And for keycode inputs
ContextActionService:BindAction(
FREEZE_ACTION,
function() return Enum.ContextActionResult.Sink end,
false,
unpack(Enum.KeyCode:GetEnumItems()))
)
This will disable character controls, and all keyboard inputs.
For other input types, just do unpack(Enum.[UserInputType]:GetEnumItems()
require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls():Enable() instead of Controls:Enable() at the end, maybe the Module is updated.
this is what is happening, do you have any clue? Only happens when disabling/enabling character movement (you can see theres a clone behind the tool of the same tool)