I have a problem, I’m trying to make a script that when you play the part a screen shake is generated, and when you stop touching the screen shake stops (I’m using this model [I am using translator])
https://www.roblox.com/library/1461025953/Camera-Shaker
Script:
local part = game.Workspace.Part
local camera = workspace.CurrentCamera
local CamaraShaker = require(game.ReplicatedStorage.CameraShaker)
local camShake = CamaraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCframe)
camera.CFrame = camera.CFrame * shakeCframe
end)
camShake:Start()
local function onTouched(hit)
print("Touched!")
shakeInstance = camShake:ShakeSustain(CamaraShaker.Presets.Earthquake)
wait(0.1)
end
local function onTouchEnded(hit)
print("Touch ended!")
shakeInstance:StartFadeOut(1)
wait(0.1)
end
part.Touched:Connect(onTouched)
part.TouchEnded:Connect(onTouchEnded)
https://gyazo.com/fa4968e22ff654ce5b25d6335a67b157
these scripts are what make it generate the screen shake
wait(4)
local camera = workspace.CurrentCamera
local CamaraShaker = require(game.ReplicatedStorage.CameraShaker)
local camShake = CamaraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCframe)
camera.CFrame = camera.CFrame * shakeCframe
end)
camShake:Start()
shakeInstance = camShake:ShakeSustain(CamaraShaker.Presets.Earthquake) -- Play Camera Shake
wait(3)
shakeInstance:StartFadeOut(1) ---Stop Camera SHAKE