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

This camera-shake-on-explosion only works in studio. How would I make it work within a server?

Asked by 6 years ago

Hi, I have a script that makes the camera shake every time an explosion happens close to the player.

ShakeDist = 50

workspace.ChildAdded:connect(function(nchild)
if nchild:IsA("Explosion") then

    local ExDist = (game.Players.LocalPlayer.Character.Torso.Position - nchild.Position).magnitude
    local ShakeMagnitude = ShakeDist/(ExDist/(nchild.BlastRadius/20))

    for z = 1, 10 do
    game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(math.random(-ShakeMagnitude,ShakeMagnitude),math.random(-ShakeMagnitude,ShakeMagnitude),math.random(-ShakeMagnitude,ShakeMagnitude))
    wait()
    end

    game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(0,0,0)
end
end)

it's located in a local script inside starterpack, on a FE game. it works perfectly in studio, but doesn't work otherwise. i cant seem to put my finger on whats wrong. any ideas?

1 answer

Log in to vote
0
Answered by 6 years ago

silly me, i must've tested it wrong because it works perfectly!

Ad

Answer this question