Now the camera itself is doing pretty epic. I also made a script that triggers whenever the player goes inside a house (making the roof transparent so you can explore it without difficulty). Here’s what it looks like: https://gyazo.com/b374f60c752d5df9d1d245889694c048
As you can see, the camera zooms in a bit when I enter the house as well. My problem is that sometimes if I stand by the door, the camera starts zooming in weird locations. (I am using the touch event to determine whether the user is in the house or not. The transparency seems to be working fine and it isnt breaking but the camera is a big issue. I used raycasting as well. Here’s what I tried:
wait(1)
while wait(0.5) do
local MyRayCast = Ray.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position, game.Players.LocalPlayer.Character.HumanoidRootPart.Position - Vector3.new(0,3,0))
local part = workspace:FindPartOnRay(MyRayCast)
if part then
if part.Name == 'Floor' then
repeat
wait()
_G.CAMERA_OFFSET = _G.CAMERA_OFFSET - Vector3.new(0,1,0)
until _G.CAMERA_OFFSET == Vector3.new(-1,20,10)
else
repeat
wait()
_G.CAMERA_OFFSET = _G.CAMERA_OFFSET + Vector3.new(0,1,0)
until _G.CAMERA_OFFSET == Vector3.new(-1,25,10)
end
end
end
But that didn’t seem to work because it never got to the value. Tried while loops as well (didn’t do too well).
Any help is appreciated.
door.Touched:Connect(function(player)
if player.Parent:FindFirstChild("Humanoid") then
if inside and debounce then
debounce = false
unzoom:FireClient(game.Players:GetPlayerFromCharacter(player.Parent))
for i,v in pairs(house:GetChildren()) do
if v.Name == "Wall" then
v.Transparency = 0
end
if v.Name == "Wedge" then
v.Transparency = 0
end
end
wait(0)
debounce = true
elseif inside == false and debounce then
debounce = false
zoom:FireClient(game.Players:GetPlayerFromCharacter(player.Parent))
for i,v in pairs(house:GetChildren()) do
if v.Name == "Wall" then
v.Transparency = 0.2
end
if v.Name == "Wedge" then
v.Transparency = 0.8
end
end
wait(0)
debounce = true
end
end
end)
Hey, the camera is scriptable. The camera seems to be doing fine. My main problem is getting the zoom function to work.
Here is what I have:
A house that has a detection part at the door way. Once it detects someone it fires a remote that zooms in the client’s camera. The zooming in part is where it gets messed up.
I don’t see a declaration for “inside”.
Perhaps you could create an instance in your character, like an IntValue, call it “Inside”, and then search for that in your function before calling your zoom method.
Remove when you leave the house.
Or just cast a ray from your character’s head to the camera to see if your character is obstructed by an object.
You can run this all on the client then and remove a burden on the server.