I’m trying to disable controls for the player. From what I’ve read you need to get the playermodule and then get the controls. When doing that, the PlayerModule cannot be found for some reason.
local LocalPlayer = game:GetService("Players").LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"):GetControls())
Infinite yield possible on 'Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")'
I created a blank studio file and dragged a playermodule in, but now it just prints: GetControls is not a valid member of ModuleScript "Players.youbigown.PlayerScripts.PlayerModule"
Did they recently change how to get controls of a player?
local cc = game.Workspace.CurrentCamera
local StarterGui = game:GetService("StarterGui")
local LocalPlayer = game:GetService("Players").LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.C then
if cc.CameraType == Enum.CameraType.Custom then
cc.CameraType = Enum.CameraType.Scriptable
Controls:Disable()
end
end
end)
game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.Return then
if cc.CameraType == Enum.CameraType.Scriptable then
cc.CameraType = Enum.CameraType.Custom
Controls:Enable()
end
end
end)
the script seems fine, what i understanded earlier was that the camera only works when the camera module doesnt exist (which is kind of strange, idk if u actually deleted the module or not) but now, i have a question your camera by default is already on Custom?
ok if I place camereascript inside playermodule it actually disables/enables movement correctly from my current testing.
However the custom camera doesn’t work anymore
Looks like this method of stopping character movement just doesn’t work when you have a customCamera
do you have any suggestions on locking the character in place after pressing C?
I tried anchoring the humanoidrootpart, but if you are in the air then you are stuck while chatting which could be a very overpowered ability in some situations
I also tried setting humanoid’s walkspeed to 0, but if the player moves and clicks C, then it just automoves
uhm i think the only way to stop the player is just walkspeed if disabling controls doesnt work, i used it a lot of times, just try to implement it well
Ok so I am kind of dumb in relation to the walkspeed solution.
My other script keeps changing the speed of the humanoid, so I just needed to add an if statement to make sure that chat isn’t opened.