#Earthquake/Shake Command
14 messages · Page 1 of 1 (latest)
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
Maybe add an option for intensity? By default it could be like that, but it's always nice to offer some adjustability 😄
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.
@sterile sparrow After a month I have decided to do your suggestion!
I edited the script.
There is now a low, medium and high intensity.
I will provide a video promptly.
Feel free to play around with the intensity values, medium and high feel similar.
Good stuff 😎
This one is good.
Issue with this, did multiplayer testing, targets the user rather than targeted player. Will fix soon.
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.