-
What do you want to achieve?
Fix the script. Keep the script running throughout the game. -
What is the issue? Include screenshots / videos if possible!
The script is working when I tested it at first. But when I reset my character the script suddenly stops. -
What solutions have you tried so far?
Phase 1: I tried changing something in the script, it didn’t work.
Phase 2: Make a duplicating script and a delete script that is in a loop, It almost works but it only happens about 1/10
Phase 3: Cry
I just found this script in a toolbox and this is what I’ve been looking for.
RemoteEvent in ReplicatedStorage
Script In ServerScriptService (so far no errors from this)
game.ReplicatedStorage.Events.Look.OnServerEvent:Connect(function(player, neckCFrame)
for key, value in pairs(game.Players:GetChildren()) do
if value ~= player and (value.Character.Head.Position - player.Character.Head.Position).Magnitude < 10 then
game.ReplicatedStorage.Events.Look:FireClient(value, player, neckCFrame)
end
end
end)
In StarterGui:
LocalScript/FollowCamScript (line 6 and 9 having error)
local tweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Root = Character:WaitForChild("HumanoidRootPart")
local Waist = Character:FindFirstChild("Waist", true)
local YOffset = Waist.C0.Y
local CFNew, CFAng = CFrame.new, CFrame.Angles
local asin = math.asin
game:GetService("RunService").RenderStepped:Connect(function()
local CameraDirection = Root.CFrame:toObjectSpace(Camera.CFrame).lookVector
if Waist then
if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
Waist.C0 = CFNew(0, YOffset, 0) * CFAng(0, -asin(CameraDirection.x), 0) * CFAng(asin(CameraDirection.y), 0, 0)
elseif Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
Waist.C0 = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)
end
end
end)
game.ReplicatedStorage.Events.Look.OnClientEvent:Connect(function(otherPlayer, waistCFrame)
local Waist = otherPlayer.Character:FindFirstChild("Waist", true)
if Waist then
tweenService:Create(Waist, TweenInfo.new(.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {C0 = waistCFrame}):Play()
end
end)
while wait() do
game.ReplicatedStorage.Events.Look:FireServer(Waist.C0)
end
Cloner:
local Player = game.Players.LocalPlayer
local Character = Player.Character
while wait() do
local item = script.Parent.FollowCamScript:Clone()
item.Parent = script.Parent.Parent
end
Destroyer:
local Player = game.Players.LocalPlayer
local Character = Player.Character
while wait() do
script.Parent.Parent.FollowCamScript:Destroy()
end