so this is a LocalScript inside of StarterCharacterScripts, but since I'm paranoid I also put it into StarterPlayerScripts. It's meant to shake the screen and change the camera's angle when the player left clicks.
local character = script.Parent local plr = game.Players[character.Name] local mouse = plr:GetMouse() function Shake() for i = 0, 1, 0.2 do workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(.02,math.rad(.1),0.02) game:GetService("RunService").RenderStepped:Wait() end for i = 0 ,1, 0.2 do workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(-.01,math.rad(-.1),-0.01) game:GetService("RunService").RenderStepped:Wait() end mouse.Button1Down:Connect(function() Shake() end) end
What did I do wrong?
local character = script.Parent local plr = game.Players[character.Name] local mouse = plr:GetMouse() function Shake() for i = 0, 1, 0.2 do workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(.02,math.rad(.1),0.02) game:GetService("RunService").RenderStepped:Wait() end for i = 0 ,1, 0.2 do workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(-.01,math.rad(-.1),-0.01) game:GetService("RunService").RenderStepped:Wait() end end mouse.Button1Down:Connect(function() Shake() end)