#Earthquake/Shake Command

14 messages · Page 1 of 1 (latest)

rich wasp
#

Made a command that aggressively shakes the target(s) screen to replicate that of an earthquake.

rich wasp
#

return function(_K)
    _K.Registry.registerCommand(_K, {
        name = "earthquake",
        aliases = { "shake", "screenshake" },
        description = "Shakes the player(s) screen.",
        group = "Fun",
        args = {
            {
                type = "players",
                name = "Player(s)",
                description = "The player(s) to shake.",
                shouldRequest = true,
            },
            {
                type = "low,medium,high",
                name = "Intensity",
                description = "The intensity of the shake.",
                optional = true,
            },
        },
        envClient = function(_K)
            _K.Remote.Earthquake:Connect(function(intensity)
                local player = game:GetService("Players").LocalPlayer
                local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid")
                if not hum then return end
                local intensityMap = {
                    low    = { range = 25, duration = 4 },
                    medium = { range = 100, duration = 5 },
                    high   = { range = 220, duration = 7 },
                }
                local level = (intensity or "medium"):lower()
                local settings = intensityMap[level] or intensityMap.medium
                local startTime = tick()
                local connection
                connection = game:GetService("RunService").RenderStepped:Connect(function()
                    if tick() - startTime > settings.duration or not hum.Parent then
                        hum.CameraOffset = Vector3.new(0, 0, 0)
                        connection:Disconnect()
                        return
                    end
                    local r = settings.range
                    local x = math.random(-r, r) / 100
                    local y = math.random(-r, r) / 100
                    local z = math.random(-r, r) / 100
                    hum.CameraOffset = Vector3.new(x, y, z)
                end)
            end)
        end,
        env = function(_K)
            return { remote = _K.Remote.Earthquake }
        end,
        run = function(context, players, intensity)
            for _, player in players do
                context.env.remote:Fire(player, intensity)
            end
        end,
    })
end

sterile sparrow
rich wasp
#

Might change that in future. Can't do it now and if I say I'll do it tomorrow I know that's not true.

rich wasp
#

I edited the script.

#

There is now a low, medium and high intensity.

#

I will provide a video promptly.

rich wasp
rich wasp
#

This one is good.

rich wasp
#

Issue with this, did multiplayer testing, targets the user rather than targeted player. Will fix soon.

rich wasp
#

I'm just going to assume I can't fix this either because yeah rusty on Lua. Sooo I'll come back to it in future or if Kohl wants to use it he can try to fix it lol.