I want to make it so inside of the non-collision part forces you into first person and doesn’t let you zoom back out, I have no scripting experience and I tried assistant but it didn’t work.
Does anybody have an example, video (Best option, visual learner), or idea how to help? Thank you.
You could make an event in the starterPlayer called ZoomEvent for when it zooms, and in the part you could put this:
script.Parent.Touched:Connect(function(part)
local human = part.Parent:FindFirstChild("Humanoid")
if human then
if human.Parent:FindFirstChild("ZoomEvent") then
human.Parent.ZoomEvent:FireClient(game.Players:GetCharacterFromPlayer(part.Parent))
end
end
)
…and in a localScript in StarterPlayerScripts you could put this:
local player = game.Players.LocalPlayer
local zoomEvent = player.ZoomEvent
zoomEvent.OnClientEvent:Connect(function()
player.CameraMode = Enum.CameraMode.LockFirstPerson
end)
So when if you touch a part you get locked in First Person right?
script.Parent.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
player.CameraMode = Enum.CameraMode.LockFirstPerson
end
end)
Put this in the part that you want to be collided with.
Are you able to edit this so when your out of the part it allows you to zoom out or it zooms you back out? If so then this is actually perfect and exactly what I need, Thank you.
script.Parent.TouchEnded:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
player.CameraMode = Enum.CameraMode.Classic
end
end)
script.Parent.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
player.CameraMode = Enum.CameraMode.LockFirstPerson
end
end)
script.Parent.TouchEnded:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
player.CameraMode = Enum.CameraMode.Classic
player.CameraMinZoomDistance = 15
wait(0.05)
player.CameraMinZoomDistance = 0
end
end)
Badly scripted but it works, put this in the part and it will work!