Here's the script I made to make the screen shake on click, however it only works when I tap click. I want it to work when the player holds lmb:
local character = script.Parent
local plr = game.Players[character.Name]
local mouse = plr:GetMouse()
local mousedown = false
local cam = game.Workspace.CurrentCamera
local shaking = false
local radius = 0
local Decounce=true
mouse.Button1Down:Connect(function()
if character:FindFirstChild("Humanoid") ~= nil then
radius = 20
radius = 150
if (shaking) then return end
shaking = true
repeat
wait()
if radius ~= 0 then
character.Humanoid.CameraOffset = Vector3.new(math.random(-radius,radius)/100,math.random(-radius,radius)/100,math.random(-radius,radius)/100)
cam.CFrame= cam.CFrame * CFrame.Angles(math.random(-radius,radius)/14000,math.random(-radius,radius)/14000,math.random(-radius,radius)/14000)
radius = radius - 13
end
until radius <= 0
shaking = false
character.Humanoid.CameraOffset = Vector3.new(1,1,0)
mouse.Button1Up:Connect(function()
mousedown = false
end)
mouse.Button1Down:Connect(function()
mousedown = true
repeat
wait(0.01)
until not mousedown
end)
end
end)
Please help me fix my script!

1 comment
lol this is a repost since the original was buried in new questions