Does anyone know whats wrong in these scripts? When my character is looking "left" and i'm looking forward the upper torso is rotating left and the same happends when i go "right"
btw its for some kind of dynamic rotation like on the game Jail break.
--local script
repeat wait() until game.Workspace.CurrentCamera ~= nil local player = game.Players.LocalPlayer; local runService = game:GetService("RunService").Heartbeat; --local playerMouse = player:GetMouse(); local playerMouse = game.Workspace.CurrentCamera; local remote = script.Parent:WaitForChild("Remote"); local character = player.Character; local humanoid = character:FindFirstChild("Humanoid"); local head = character:FindFirstChild("Head"); local lowertorso = character:FindFirstChild("UpperTorso"); local neck = head ~= nil and head:FindFirstChild("Neck") or nil; local waist = lowertorso ~= nil and lowertorso:FindFirstChild("Waist") or nil; local lastMousePosition = playerMouse.CFrame.lookVector; runService:connect(function() if head ~= nil then if neck ~= nil and lastMousePosition ~= playerMouse.CFrame.lookVector then remote:FireServer(playerMouse.CFrame.lookVector,waist,character); lastMousePosition = playerMouse.CFrame.lookVector; else neck = head ~= nil and head:FindFirstChild("Neck") or nil; end else head = character:FindFirstChild("Head"); end end)
-script
local remote = Instance.new("RemoteEvent", script); remote.Name = "Remote"; remote.OnServerEvent:connect(function(player, mouseDirection, waist,char) waist.C1 = CFrame.new(Vector3.new(0, -.4, 0)) * CFrame.Angles(-math.asin(mouseDirection.Y),-math.asin(mouseDirection.X),0) end)