Hey all, I’m trying to setup a system where it teleports 2 or more people to a location, locks their movement, then sets their camera to a specific part. I got the teleportation down but the other two are giving me quite the challenge. As for movement I’ve tried just setting the walkspeed to 0 but for whatever reason that won’t work. And as for the camera I tried using CameraSubject but it only for camera for 1 of the 2 players and even then they could still look around (I want it to be static with no inputs moving it). Here are the scripts I tried, any tips or solutions would be greatly appreciated!
Movement Disable Attempt:
local function disablePlayerMovement(player)
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
end
end
end
local function restorePlayerMovement(player)
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
end
end
end
Camera Set Attempt:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local duelCameraEvent = ReplicatedStorage:WaitForChild("DuelCameraEvent")
local cameraPart = script.Parent
local playersInDuel = {}
local function lockCamera(player)
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = cameraPart
end
local function unlockCamera(player)
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
end
duelCameraEvent.OnServerEvent:Connect(function(player, cameraTarget)
if cameraTarget == cameraPart then
playersInDuel[player] = true
player:LoadCharacter() -- ensure the player resets if needed
duelCameraEvent:FireClient(player, cameraPart)
else
playersInDuel[player] = nil
duelCameraEvent:FireClient(player, nil)
end
end)