The following code that I have keeps a small part under the player at all times. The camera also provides a 'birds-eye view' of the player and everything around the player. When I test it offline, everything seems to work perfectly.
This is a localscript under StarterGui. I have set the DevCameraOcclusionMode to Invisicam through StarterPlayer and the Max and MinZoom property are both at 400.
It seems to only have this issue because the camera is of type scriptable.
Visual Examples:
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:wait()
local root = chr:WaitForChild("HumanoidRootPart")
local leftLeg = chr:WaitForChild("Left Leg")
local rightLeg = chr:WaitForChild("Right Leg")
local hum = chr:FindFirstChild("Humanoid")
local camera = workspace.CurrentCamera
camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable;
camera.CameraSubject = plr;
local part = Instance.new("Part",workspace)
part.CanCollide = false;
part.Anchored = true;
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(7,.1,6)
part.Transparency = 1;
local gui = Instance.new("SurfaceGui",part)
gui.Face = "Top"
local decal = Instance.new("ImageLabel",gui)
decal.Size = UDim2.new(1,60,.8,0)
decal.Position = UDim2.new(.1,-20,.2,-15)
decal.Image = "http://www.roblox.com/asset/?id=276509139"
decal.BackgroundTransparency = 1;
local falling = false;
local mouse = plr:GetMouse()
mouse.TargetFilter = workspace.Map
function getBase(side)
local sign = (side == "up" and 1 or -1);
local ray = Ray.new(root.Position, Vector3.new(0, 1000 * sign, 0))
local hit, position = workspace:FindPartOnRayWithIgnoreList(ray, {chr,part,camera})
return hit,position;
end
--[[
hum.Died:connect(function()
part:Destroy()
chr = plr.CharacterAdded:wait()
root = chr:WaitForChild("HumanoidRootPart")
leftLeg = chr:WaitForChild("Left Leg")
rightLeg = chr:WaitForChild("Right Leg")
hum = chr:FindFirstChild("Humanoid")
end)]]
hum.FreeFalling:connect(function(plrFalling)
falling = plrFalling
end)
game:GetService("RunService").RenderStepped:connect(function()
camera.CoordinateFrame = CFrame.new(CFrame.new(root.Position + Vector3.new(-20,45,0)).p,root.Position)
root.CFrame = CFrame.new(root.Position, Vector3.new(mouse.Hit.p.X, root.Position.Y, mouse.Hit.p.Z))
if falling then
local parter,pos = getBase("down");
part.CFrame = CFrame.new(pos, pos + Vector3.new(root.CFrame.lookVector.X, 0, root.CFrame.lookVector.Z)) --[[*CFrame.Angles(0,math.rad(-90),0);]]
elseif hum.Jump == false then
part.CFrame = (root.CFrame - (Vector3.new(0,leftLeg.Size.Y,0) + Vector3.new(0,root.Size.Y/2,0))) * CFrame.new(-.5,0,0);
end
end)
The only issue is that the 'Invisicam' mode that sets all parts between the camera and player to translucent only seems to work in offline mode. This doesn't function at all online. And another issue is that when I reset, the camera and 'part' that is being instanced doesn't also reset. Instead the camera gets stuck and no new part is instantiated.
So I have two questions:
1.) How can I get the DevCameraOcclusionMode to properly function?
2.) How can I prevent the camera from getting stuck in one spot after the player dies?

2 comments
Cheers, mate! I owe you one
@DigitalVeer Haha thanks. Keep me posted on how what you are making turns out!