You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
fix the issue with the script and find the answer because i got stuck with this for a long time -
What is the issue? Include screenshots / videos if possible!
Make character not go crazy and jiggle when i spin my camera left/right on fast sens i can even see my character fully -
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
i looked at dev forum but i havent found the solution
the code:
local VRService = game:GetService("VRService")
if VRService.VREnabled then
return
end
local ViewAccessories = false
local ViewHeadAccessories = false
local RealisticView = true
local AutoLockFirstPerson = true
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Offset = Vector3.new()
local Player = Players.LocalPlayer
function Update()
local Character = Player.Character
local Camera = workspace.CurrentCamera
if not Character then
return
end
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Head = Character:WaitForChild("Head")
for Index, Item in ipairs(Character:GetChildren()) do
if Item:IsA("BasePart") then
if Item.Name ~= "Head" then
Item.LocalTransparencyModifier = 0
else
Item.LocalTransparencyModifier = 0
Item.CastShadow = true
end
elseif Item:IsA("Accoutrement") then
local Handle = Item:FindFirstChild("Handle")
if Handle then
local ConnectedToHead = (Handle:FindFirstChild("HatAttachment") or Handle:FindFirstChild("HairAttachment") or Handle:FindFirstChild("FaceAttachment") or Handle:FindFirstChild("NeckAttachment")) ~= nil
if ConnectedToHead then
if ViewAccessories and ViewHeadAccessories then
Handle.LocalTransparencyModifier = 0
else
Handle.LocalTransparencyModifier = 1
end
else
if ViewAccessories then
Handle.LocalTransparencyModifier = 0
else
Handle.LocalTransparencyModifier = 1
end
end
end
end
end
if RealisticView then
local Origin = Camera.CFrame
local Out = Camera.CFrame * CFrame.new(0, 0, -2)
local Y_Diff = (Origin.Y - Out.Y) * -1
local z_offset = (math.min(Y_Diff, 0) * 0.25) - 0.25
local look_down_alpha = math.clamp(Y_Diff / -2, 0, 1)
local start_y_offset = 0.25
local end_y_offset = -0.5
local y_offset = start_y_offset + (end_y_offset - start_y_offset) * look_down_alpha
local Camera_Offset = Vector3.new(0, y_offset, z_offset)
local UpperTorso = Character:FindFirstChild("HumanoidRootPart")
if UpperTorso then
local OffsetVal = HumanoidRootPart.CFrame:toObjectSpace(Head.CFrame).p
Offset = Camera_Offset + (OffsetVal - Vector3.new(0, 1.5, 0))
else
Offset = Camera_Offset
end
Humanoid.CameraOffset = Offset
else
Humanoid.CameraOffset = Vector3.new()
end
end
Player.CameraMode = Enum.CameraMode.LockFirstPerson
RunService.RenderStepped:Connect(Update)
```z