#Part that makes your camera shake/distort when looking at it
1 messages · Page 1 of 1 (latest)
There’s this property in the camera to see where it’s looking at. You could use that to check if the player is looking at a certain part/area
but dude he needs the script:(
This is #1020374354867007528 not #getentirescriptsfrombasicconcepts

yea dude
True, dont expect to create scripts
but guy needs help
so i'll help him 🙂
`-- Put this script in a part that you want the player to look at
local targetPart = script.Parent -- The part that the player needs to look at
local shakeIntensity = 0.2 -- The intensity of the camera shake
local shakeSpeed = 10 -- The speed of the camera shake
local shakeDuration = 0.5 -- The duration of the camera shake
function shakeCamera()
local camera = game.Workspace.CurrentCamera
local shakeTimer = shakeDuration
while shakeTimer > 0 do
local shakeAmount = shakeIntensity * shakeTimer
local shakeOffset = Vector3.new(
math.sin(time() * shakeSpeed) * shakeAmount,
math.cos(time() * shakeSpeed * 2) * shakeAmount,
math.sin(time() * shakeSpeed * 3) * shakeAmount
)
camera.CFrame = camera.CFrame + shakeOffset
wait()
shakeTimer -= wait()
end
end
function onRenderStepped()
local camera = game.Workspace.CurrentCamera
local ray = Ray.new(camera.CFrame.p, camera.CFrame.LookVector * 100)
local hitPart, hitPosition, hitNormal = game.Workspace:FindPartOnRay(ray)
if hitPart == targetPart then
shakeCamera()
end
end
game:GetService("RunService").RenderStepped:Connect(onRenderStepped)`
sorry I had to
oh m god y