How is it looking?
(Chars Chars Chars)
Thank god you responded…
Read the message above!
Just a problem of rubberbanding and I don’t know how to fix it.
OK, I think I found the solution, had to look at someone else code though…
local script
local runservice = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local event = game:GetService("ReplicatedStorage"):WaitForChild("BodyToMouseCFrameEvent")
runservice.RenderStepped:Connect(function()
event:FireServer(math.asin(mouse.Hit.LookVector.Y),character.Humanoid.RigType)
end)
server script
local event = game.ReplicatedStorage.BodyToMouseCFrameEvent
local r6NeckC0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
local r6RShoulderC0 = CFrame.new(1, 0.5, 0, -4.37113883e-08, 0, 1, -0, 0.99999994, 0, -1, 0, -4.37113883e-08)
local r6LShoulderC0 = CFrame.new(-1, 0.5, 0, -4.37113883e-08, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883e-08)
local r15NeckC0 = CFrame.new(0, 0.8, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local r15WaistC0 = CFrame.new(0, 0.2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local r15RShoulderC0 = CFrame.new(1, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local r15LShoulderC0 = CFrame.new(-1, 0.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
event.OnServerEvent:Connect(function(player, theta, rigType)
if player.Character.Humanoid.Health <= 0 then return false end
local neck = rigType == Enum.HumanoidRigType.R15 and player.Character.Head.Neck or player.Character.Torso.Neck;
if rigType == Enum.HumanoidRigType.R15 then
local waist = player.Character.UpperTorso.Waist;
local rShoulder = player.Character.RightUpperArm.RightShoulder;
local lShoulder = player.Character.LeftUpperArm.LeftShoulder;
neck.C0 = r15NeckC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, 0, 0);
waist.C0 = r15WaistC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, 0, 0);
rShoulder.C0 = r15RShoulderC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, 0, 0);
lShoulder.C0 = r15LShoulderC0 * CFrame.fromEulerAnglesYXZ(theta*0.5, 0, 0);
elseif rigType == Enum.HumanoidRigType.R6 then
local rShoulder = player.Character.Torso["Right Shoulder"];
local lShoulder = player.Character.Torso["Left Shoulder"];
neck.C0 = r6NeckC0 * CFrame.fromEulerAnglesYXZ(-theta, 0, 0);
rShoulder.C0 = r6RShoulderC0 * CFrame.fromEulerAnglesYXZ(0, 0, theta);
lShoulder.C0 = r6LShoulderC0 * CFrame.fromEulerAnglesYXZ(0, 0, -theta);
end
end)
1 Like
Yeah it’s best to look at your own code throughly before going to the devforum, especially since it isn’t the place to ask for free scripts.
1 Like