I made a simple Module that makes a UI shaking effect
It’s very simple.
Please report any bugs you find, I’d be very thankful
It’s also similar to sleitnick’s EZ Camera Shake
HOW TO USE
Functions
ShakeOnce() function
Example Code:
local Module = require(game.ReplicatedStorage:FindFirstChild('GuiShakerModule'))
local GuiElement = script.Parent.YourText
Module:ShakeOnce(GuiElement, 4, 0.4, 0)
-- The gui object, intensity, fade out time, delay
Result:
As you can see it works very well!
Shake() and ShakeOnce() are pretty different though.
Shake() function
Example Code:
local Module = require(game.ReplicatedStorage:FindFirstChild('GuiShakerModule'))
local GuiElement = script.Parent.YourText
Module:Shake(GuiElement, 4, 2)
-- The gui element, intensity, duration
Result:
You can see the difference, we set the duration to 2, and the text was shaking for 2 seconds!
You are also able to move the object while it has the shaking effect, thats right!
local RunService = game:GetService('RunService')
local Module = require(game.ReplicatedStorage:FindFirstChild('GuiShakerModule'))
RunService.RenderStepped:Connect(function(dt)
Module:Shake(script.Parent.YourText, 12, 0.1)
local Attribute = script.Parent.YourText:GetAttribute("OriginalPosition")
if Attribute then
script.Parent.YourText:SetAttribute("OriginalPosition", UDim2.new(math.random(1,2)/10,0,0,0))
else
script.Parent.YourText:SetAttribute("OriginalPosition", UDim2.new(math.random(1,2)/10,0,0,0))
end
end)
The module automatically creates 2 attributes, which are OriginalPosition and OriginalRotation
I’m pretty bad at explaining but I hope you can understand
I hope I helped some people!
NOTE:
- I might revamp this entire module because of more scripting knowledge I’ve gained over the months!