Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make an earthquake effect in Roblox?

Recently, I have attempted to make a tool, which serves the purpose as an attack, which deals damage to hit players. Here's a quick briefing of what this tool does; first, it makes a hulk smash type animation in the wielder's humanoid. Then, when anything touches the arms when the animation is proceeding, it creates a giant shock-wave making everything go flying. The trouble is, I made an if statement to do a separate function when the hand completes its animation+hits the ground, which I named, "Mountainsxdxdxd" for some reason, then the ground shakes, the part which I don't know how to re-create. Do I violently make the ground shake with a gyro, or is there another way?

1 comment

0

If I'm interpreting this correctly, you could constantly change the field of view or offset the coordinateframe of the camera randomly. if you wanted to make other players camera shake you could create a RemoteEvent on the server to accomplish this.

1 answer

This could kinda simulate an effect.

Shakes camera up and down.

--Earthquake is just the custom name i gave to the event, link this function to however you want to trigger it.
Earthquake.OnClientEvent:Connect(function()
	
	local cam = game.Workspace.CurrentCamera -- get camera
	cam.CameraType = "Track" -- set camera to mode where we can move it without freezing it's position. Chose track because it fits the best.
	
	--Actual effect
	for i=1.5,0,-0.05 do
		if i > 1 then
			i = 1
		end
		cam.CFrame = cam.CFrame + Vector3.new(0,i,0)
		wait(0)
		cam.CFrame = cam.CFrame - Vector3.new(0,i,0)
		wait(0)
	end
	
	--reset camera to original mode.
	cam.CameraType = "Custom"
end)

1 comment

0

Is wait(0) the same as wait()?

This discussion is preserved as it was. New answers, comments, and votes are closed.