Player Controls Help (solved)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to know/have a script which checks if a gui is enabled, and if it is, the player cannot move. and if the gui isn’t enabled, they can move.
  2. What is the issue? Include screenshots / videos if possible!
    I don’t know how to achieve it, and i cannot figure it out.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried using Disable() and Enable() by the PlayerControls module, but it doesn’t enable again. I have also used the Humanoid.WalkSpeed thingy and changing it when it isn’t enabled or is enabled, but broke. This may be because I have changed the default walkspeed in StarterPlayer, but I don’t know.

This is my current Humanoid walkspeed script:

local defWalkSpeed = 23

local plr = game.Players.LocalPlayer
local char = plr.Character
local huma = char.Humanoid
local gui = plr.PlayerGui.LoadingScreen

while true do
	if gui.Enabled == true then
		huma.WalkSpeed = 0
	else
		huma.WalkSpeed = defWalkSpeed
		script:Destroy()
	end
	wait(0.5)
end
local defWalkSpeed = 23

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Gui = Player.PlayerGui.LoadingScreen
Gui:GetPropertyChangedSignal("Enabled"):Connect(function()
	if gui.Enabled then
		Humanoid.WalkSpeed = 0
	else
		Humanoid.WalkSpeed = defWalkSpeed
	end
end)

Doesn’t work, but thanks for trying.

did you put that in local script?

yes

i see script named LoadingScreenConfig i guess it is what enabling and disabling loading screen right?
if so then just change character walk speed inside that script

You could try anchoring their HumanoidRootPart instead of changing their walkspeed.

Put this in StarterGui. [That mean just change script to this]

local defWalkSpeed = 23

local Player = game.Players.LocalPlayer
local Character = Player.Character

local Humanoid = Character:WaitForChild("Humanoid")

if not Humanoid then retturn end

local Gui = Player.PlayerGui.LoadingScreen
Gui:GetPropertyChangedSignal("Enabled"):Connect(function()
	if Gui.Enabled then
		Humanoid.WalkSpeed = 0
	else
		Humanoid.WalkSpeed = defWalkSpeed
	end
end)

isnt that exactly what i had sent above also return cant be used outside of function

Doesn’t work :confused:

character limit

Try this. This must work

local defWalkSpeed = 23

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Gui = Player.PlayerGui.LoadingScreen
Gui:GetPropertyChangedSignal("Enabled"):Connect(function()
	if Gui.Enabled then
		Humanoid.WalkSpeed = 0
	else
		Humanoid.WalkSpeed = defWalkSpeed
	end
end)

@V_ladzec made typo : line 10 :frowning:

Doesn’t work

character limit ----

its not type error Gui.Enabled returns boolean

Doesn’t work.

character limit --------

It’s

Gui.Enabled

Isn’t it?

i guess you should know how if statement works

there’s no gui variable.
(char limit)

cant you do something like if gui.Enabled == true then?

Stops me from moving when I join, but when I ‘un-enable’ the gui, i cant walk

Try it

task.wait()
local defWalkSpeed = 23

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Gui = Player.PlayerGui.LoadingScreen

	if Gui.Enabled then
		Humanoid.WalkSpeed = 0
	end
repeat task.wait() until Gui.Enabled = false
		Humanoid.WalkSpeed = defWalkSpeed
1 Like