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

How to make an earthquake effect in Roblox?

Asked by 7 years ago

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?

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. NewVoids 97 — 7y

1 answer

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

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)
0
Is wait(0) the same as wait()? vissequ 105 — 5y
Ad

Answer this question