So here, I’ve been trying to make it so the CameraSubject of CurrentCamera becomes LocalPlayer’s head when the character sits on a specific seat that plays an animation. The animation works, however it doesn’t seem like the remote event is not being fired.
Seat Script (ServerScript):
local seat = script.Parent;
local pov = game.ReplicatedStorage.POV;
local char;
function added(child)
if (child.className=="Weld") then
local human = seat.Occupant;
if human ~= nil then
anim = human:LoadAnimation(seat.sitanim);
anim.Looped = true;
anim:Play();
seat.Transparency = 1;
char = human;
pov:FireClient(game.Players:GetPlayerFromCharacter(char), true);
end;
end;
end;
function removed(child2)
if anim ~= nil then
anim:Stop();
anim:Remove();
seat.Transparency = 0.3;
pov:FireClient(game.Players:GetPlayerFromCharacter(char), false);
end;
end;
seat.ChildAdded:connect(added);
seat.ChildRemoved:connect(removed);
LocalScript (in Backpack):
local char = player.Character or player.CharacterAdded:Wait();
local head = char:WaitForChild'Head';
local camera = workspace.CurrentCamera;
local remoteevent = game.ReplicatedStorage.POV;
local scream = false;
local runs = game:GetService'RunService';
runs.RenderStepped:Connect(function()
if (scream == true) then
camera.CameraType = Enum.CameraType.Scriptable;
camera.CFrame = CFrame.new(head.CFrame.Position, head.CFrame.Position + head.CFrame.lookVector)
elseif (scream == false) then
camera.CameraType = Enum.CameraType.Custom;
camera.CameraSubject = char:WaitForChild'Humanoid';
end;
end);
remoteevent.OnClientEvent:Connect(function(plr, activation)
if (activation == true) then
scream = true;
print'true!';
else
scream = false;
print'false!';
end;
end);
I put the print in order to see if the scripts work properly. Nothing was printed, and the camera’s subject was consistently being set to Humanoid, which meant that ‘scream’ was still false. I didn’t get any errors. Can someone tell me a possible solution?