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

How do I make this screen shake have multiplayer support?

Asked by 6 years ago
p = game.Players.LocalPlayer
c = p.Character
ShakeForHowLong = 100000000 --Shake for 10 seconds.
magnitude = 1 --How much it shakes; can be set to any number or decimal or fraction.

TimePassed = 0 --Ignore
game:GetService("RunService").RenderStepped:connect(function (s)
if TimePassed < ShakeForHowLong then
c.Humanoid.CameraOffset = Vector3.new(magnitude*(math.random()*2 - 1),0,magnitude*(math.random()*2 - 1))
else
c.Humanoid.CameraOffset = Vector3.new(0,0,0)
return
end
TimePassed = TimePassed + s
end)

0
Everytime, I play in-game on the ROBLOX client, it doesn't work at all. In studio, it works perfectly fine, what can be the fix for this problem? Moderation_Times -9 — 6y
0
Hm. Try going into the game.Workspace.Camera I think that is global camera. iRexBot 147 — 6y
0
1) Use local variables. They get accessed faster in Lua. 2) Provide an example of the code you have tried, and explain what you want it to do. Do not only post code, or only post an explanation. Both are required to make a good question. hiimgoodpack 2009 — 6y

Answer this question