Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What do i need to add to get the camera to reset and not end in a random place?

Asked by 4 years ago
Edited 4 years ago
--//Variables
local tool = script.Parent print(1)
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local db = false
--//Equipped
tool.Equipped:Connect(function(mouse) print(2)
 mouse.Button1Down:Connect(function()
  if not db then
   db = true
   game.ReplicatedStorage.ServerEvents.ShakeEvent:FireServer()print(3)
   wait(4)
   db = false
  end
 end)
end)

game.ReplicatedStorage.ServerEvents.ShakeEvent.OnClientEvent:Connect(function() print(4)
    for i = 1,100 do
      local a = math.random(-100,100)/100
      local b = math.random(-100,100)/100
      local c = math.random(-100,100)/100
      hum.CameraOffset = Vector3.new(a,b,c)
      wait()
    end
end)
0
Your supposed to set it back the CameraOffset to normal after the loop that is creating the “shake” effect for your camera. A way to do this is to print the CameraOffset then take those values and assign it to the Humanoid when you are done your “shake” effect. 123nabilben123 499 — 4y

Answer this question