gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
Can you make me a script to make the player’s character not turn around when moving the…
- User
Can you make me a script to make the player’s character not turn around when moving the camera, but also allowing he head and hands to face corresponding to where the player is looking at in a roblox studio script?
- Assistant
Sure, here is a sample script that should accomplish that:
codelocal player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() -- Disable the turn when moving the camera camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable -- Track the player's head and hands local head = character:WaitForChild("Head") local leftHand = character:WaitForChild("LeftHand") local rightHand = character:WaitForChild("RightHand") -- Update the head and hands to face where the player is looking at local function updateHead() local lookDirection = camera.Focus.Position - head.Position head.CFrame = CFrame.lookAt(head.Position, head.Position + lookDirection, Vector3.new(0, 1, 0)) leftHand.CFrame = head.CFrame * CFrame.new(-1, 0, 0) rightHand.CFrame = head.CFrame * CFrame.new(1, 0, 0) end -- Update every frame while the player is in-game game:GetService("RunService").RenderStepped:Connect(function() updateHead() end)