How may i make a script that changes your camera upon an block touch nor when an statement/function is true?
You can use the Camera.CameraType = Enum.CameraType.Scriptable function if the part is touched.
LocalScript inside of StarterPlayerScripts for :Touched() event:
local Part = game.Workspace.Part
local LocalPlayer = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
Part.Touched:Connect(function(touchedPart)
local player = game:GetService("Players"):GetPlayerFromCharacter(touchedPart.Parent)
if player.UserId == LocalPlayer.UserId then
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(0,0,0) --Set the position of the camera here.
end
end)
To set the camera’s style back to going around the player, use:
camera.CameraType = Enum.CameraType.Custom
1 Like
Ah, Thanks! That’s what i was looking for!
1 Like