i have been having problems with this code. I want to make it stop an movement of the player when that frame is visible. I tried the script below but if didn't work (i took the movement control script from roblox's devforum). PLease help, thnx ps: I am new so i am bad at scripting
local UIP = game:GetService("UserInputService") if game.StarterGui.ScreenGui2.Frame.Visible == true then if UIP.UserInputType == Enum.UserInputType.Keyboard then if UIP.KeyCode == Enum.KeyCode.W and Enum.KeyCode.A and Enum.KeyCode.S and Enum.KeyCode.D then local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls() controls:Disable() end end end
Instead of doing the long way, your way. You can always just do when the UI is touched just set the players walkspeed and jumppower to 0. And when you close it just revert their speed and jump.