Hi guys! So I’d like to make a script, which disables the player from any interactions, and after pressing on the Play button, the player will able to move, will able to equip tools again. And the StarterPlayer → CameraMode will get a LockFirstPerson value.
Here’s my script:
local p = script.Parent.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
p.Team = game:GetService("Teams").Red
p:LoadCharacter()
wait(3)
script.Parent.Parent.Parent.Enabled = false
end)
To disable any player action/movement it would be something like this (in a local script)
Y
local LocalPlayer = game:GetService("Players").LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()
local Camera = workspace.CurrentCamera
Controls:Disable()
Camera.CameraType = Enum.CameraType.Fixed
— this should disable character movement and the ability to move around with your camera
To enable. Everything again it would be something like this
Then you would have to use a remote event to do it
Put a remote event in replicated storage and do this
In a local script In starter character scripts do
local LocalPlayer = game:GetService("Players").LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()
local Camera = workspace.CurrentCamera
local RM = game.ReplicatedStorage.RemoteEvent
RM.OnClientEvent:Connect(function(instruction)
if instruction == “DisableControls” then
Controls:Disable()
Camera.CameraType = Enum.CameraType.Fixed
elseif instruction == “EnableControls” then
Controls:Enable()
Camera.CameraType = Enum.CameraType.Custom
end
end)
Now in your server script do
—if you want it to be disabled:
local RM = game.ReplicatedStorage.RemoteEvent
RM:FireClient(p,”EnableControls”)
— if you want to disable
Rm:FireClient(p,”DisableControls”)
This is more practical because now you can do this in any server script if you need to disable their controls