How do I fix this?

I’m making a horror game which in a specific part you have to hide under a bed, which changes your camera, and I’m using a script that I found on the toolbox which shows your limbs in first person, but after you leave the hiding spot the body and limbs don’t rotate with you, as if your head can do a 360 :sweat_smile:

script:

local self,player = script.Parent,game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid") -- waits for the humanoid in the character



function antiTrans(part)
	if part and part:IsA("BasePart") and( part.Name=="Left Arm" or part.Name=="Right Arm" or part.Name == "Right Leg" or part.Name == "Left Leg" or part.Name == "Torso") then -- checks if a part and is a arm
		part.LocalTransparencyModifier = part.Transparency
		part.Changed:connect(function (property)    
			part.LocalTransparencyModifier = part.Transparency--Changes the local modifyer(client side only)
		end)
	end
end

for _,v in pairs(char:GetChildren()) do
	antiTrans(v) -- adds all parts
end

did you set humanoid.autorotate to false?

No, it can rotate before you hide but now it won’t

Can we see the script for hiding under the bed?

script.Parent.Triggered:Connect(function(plr)
if plr and plr:IsA(“Player”) then
local character = plr.Character
local humanoid = character and character:FindFirstChild(“Humanoid”)

  if character and humanoid then
  	local grandparent = script.Parent.Parent

  	if grandparent then
  		local ogPos = plr.Character.HumanoidRootPart.CFrame
  		plr.Character.HumanoidRootPart.CFrame = workspace.HidingPlace.CFrame
  		game.ReplicatedStorage.Events.ChangeCamera:FireClient(plr, grandparent.CameraPart, ogPos)
  		wait(2)
  		workspace.Wendigo.AI.Enabled = false
  		workspace.Wendigo.Distance.Value = 30
  		
  		local targetPosition1 = workspace.WendigoDoorMove.Position
  		local targetPosition2 = workspace.WendigoDoorLeave.Position
  		local targetPosition3 = workspace.WendigoSpawn.Position
  		
  		local wendigoHumanoid = workspace.Wendigo.Humanoid
  		
  		wendigoHumanoid:MoveTo(targetPosition1)
  		wendigoHumanoid.MoveToFinished:Wait()
  		wendigoHumanoid:MoveTo(targetPosition2)
  		wendigoHumanoid.MoveToFinished:Wait()
  		wendigoHumanoid:MoveTo(targetPosition3)
  		wendigoHumanoid.MoveToFinished:Wait()
  		
  		game.ReplicatedStorage.Events.ChangeObjective:FireAllClients("It’s safe now. Press SPACE to leave your hiding spot.")
  		wait(4)
  		game.ReplicatedStorage.Events.ChangeObjective:FireAllClients("Objective: Head to the shed behind the house to gather materials for barricading the broken wall. Be swift, and remain alert for the Wendigo.")
  		workspace.Wendigo.AI.Enabled = true
  	end
  else
  	warn("Character or Humanoid not found for player " .. plr.Name)
  end

else
warn(“Invalid player or player instance”)
end
end)

game.ReplicatedStorage.Events.ChangeCamera.OnClientEvent:Connect(function(cframe, ogCFrame)
originalCFrame = ogCFrame
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CameraSubject = cframe
workspace.CurrentCamera.CFrame = cframe.CFrame
end)

its a proximityprompt

do you change the camera type back to Enum.CameraType.Custom after that event? it could be that you’re still using scriptable and its not rotating your character to face the camera

Oh I found the problem- I set the camera subject back to the head and not the humanoid…

1 Like