Server-Sided R6 torso movement (Mouse)

just torso because the head and arms will move with torso, but if that task is impossible, then arms AND head movement will work! And not just for aiming! I want this when a player has a tool equipped. So maybe the script(s) can be in the tool…?

Just follow the tutorial I sent earlier. IKs automatically apply to everything.

Alright (for real this time :sob:), you can use the player’s camera orientation for this. This is going to require local references and remote events as the camera can only be referenced locally.

On a local script under the character you can do something like:

local cameraComms = game.ReplicatedStorage.CameraGrab -- RemoteEvent
local camera = workspace.CurrentCamera
local function grabCamOrientation()
  local newOrient = Vector3.new(camera.Focus.Orientation) -- new vector because server cannot reference camera whatsoever
  return newOrient
end

cameraComms.OnClientEvent:Connect(function() -- just edited this, it was broke
  local toReturn = grabCamOrientation()
  cameraComms:FireServer(toReturn)
end)

In a server script:

local cameraComms = game.ReplicatedStorage.CameraGrab -- remote event in rep storage
local runservice = game:GetService("RunService")

local function processCharacterLooking(chr, orient)
  local torso = chr.Torso -- R6
  torso.CFrame.Orientation = Vector3.new(orient)
end

runservice.Heartbeat:Connect(function()
   cameraComms:FireAllClients()
end)

cameraComms.OnServerEvent:Connect(function(chr, ornt)
  processCharacterLooking(chr, ornt)
end)

im not entirely sure if this will work all that well, given im not entirely sure how to use orientation that well with characters, but it should move your torso.

1 Like

Lmk if you’re still up to help me! I understand if not, no worries!

1 Like

I edited the post above. /////

1 Like

I’m getting this error for the local script > line 4 … “Orientation is not a valid member of CFrame”

I’m working out the bazillion errors it keeps throwing at me, standby.
Edit: I’m still here working on it don’t leave yet

1 Like

Couldn’t you also use .Changed and check the property instead of running every 10th of a millisecond?

2 Likes

@TyKing_22 i’ve been testing for hours trying different things and i got something that works without error (finally, thank god)

local script (starter character scripts)

local cameraComms = game.ReplicatedStorage.CameraGrab -- RemoteEvent
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer

camera:GetPropertyChangedSignal("CFrame"):Connect(function()
	local axis = camera.CFrame.LookVector.Y

	if axis > 1 or axis < -1 then 
		error()
	end
	
	cameraComms:FireServer(player.Character, axis)
end)

server script (workspace)

local cameraComms = game.ReplicatedStorage.CameraGrab -- RemoteEvent
local runService = game:GetService("RunService")

cameraComms.OnServerEvent:Connect(function(plr, chr, axis)
	if chr then
		chr.Torso["Right Shoulder"].C0 = CFrame.new(chr.Torso["Right Shoulder"].C0.Position) * CFrame.Angles(0,math.rad(90),math.rad(axis*60))
		chr.Torso["Left Shoulder"].C0 = CFrame.new(chr.Torso["Left Shoulder"].C0.Position) * CFrame.Angles(0,math.rad(-90),math.rad(-axis*60))
		chr.Torso["Neck"].C0 = CFrame.new(chr.Torso["Neck"].C0.Position) * CFrame.Angles(130+axis,0,135)
	else
		chr.Torso["Right Shoulder"].C0 = CFrame.new(chr.Torso["Right Shoulder"].C0.Position) * CFrame.Angles(0,math.rad(90),math.rad(axis*60))
		chr.Torso["Left Shoulder"].C0 = CFrame.new(chr.Torso["Left Shoulder"].C0.Position) * CFrame.Angles(0,math.rad(-90),math.rad(-axis*60))
		chr.Torso["Neck"].C0 = CFrame.new(chr.Torso["Neck"].C0.Position) * CFrame.Angles(130+axis,0,135)
	end
end)

I’m very sorry I couldn’t get it to go left and right, there’s probably a tutorial on it somewhere, I’m tired and I’m going to bed. Goodnight and Happy Thanksgiving!

1 Like

It’s okay! i don’t need a left and right! I can’t thank you enough for your time and efforts! have a good sleep, wake up fresh and happy thanks giving!!!

1 Like

ONE MORE THING! when i look up, arms and head bend down, when i look down, arms and head bend up

its a weird thing with third person i think, it should work in first person, if not, just contact me and i’ll fix it rq

I’m in first person and it’s bending opposite from where im looking: looking down > bends up, looking up > bends down

1 Like

alright lemme edit the solved message rq so its fixed
Edit: should be fixed now

1 Like

WORKS!!! THANK YOU!!! :heart_hands: !!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.