Hello! I just made a really awesome rift opening script that works as intended. Although, as I keep looking at it, it just seems a bit cluttered. A bit messy. Is this code okay as it is, or should I make it more proper and organized?
SCRIPT:
local riftFolder = script.Parent
local stand = riftFolder.Stand
local groundParticles = riftFolder.Part
local secretButton = riftFolder.Clickable
--//RIFT
local model = riftFolder.WOW
local crack = model.crack
local crackPrompt = crack.ProximityPrompt
local particle = model.particle
local light = particle.PointLight
local amongus = model.amongus.SurfaceGui
--//BEAM
local beam = model.BEAM
local plunge = beam.Plunge
local source = beam.Source
local water = beam.Water
--//PARTICLES
local rockEmitter = groundParticles.rockEmitter
local dustEmitter = groundParticles.dustEmitter
local portal1 = particle.portal
local portal2 = particle.pulse
--//SOUND_STAND
local crumble = groundParticles.hatdog
--//SOUND_RIFT
local pulse = particle.beat
local ambience = particle.ambience
local crunch = crack.crunchy
local crunch2 = crack.crunchy2
local rumble = crack.rumble
--//SOUND_BREAK
local SWING = script.hammer
local SWING2 = script.hammer2
local BREAK = particle.HIT
local SHATTER = particle.shatter
local RIFT_OPEN = particle.rift
--//SERVICES
local players = game:GetService("Players"):GetChildren()
local shakeEvent = game:GetService("ReplicatedStorage").thugShake
local ts = game:GetService("TweenService")
local inf = 999999*999999
--//ONGOING
wait(3)
crunch2:Play()
ts:Create(crack, TweenInfo.new(0.4), {Size = Vector3.new(0.2,0.2,0.2)}):Play()
wait(2)
crunch:Play()
ts:Create(crack, TweenInfo.new(0.75), {Size = Vector3.new(1,1,1)}):Play()
wait(1)
secretButton.Transparency = 0
secretButton.ClickDetector.MaxActivationDistance = 7.5
rumble:Play()
--//STAND_RISE
secretButton.ClickDetector.MouseClick:Connect(function()
wait(1)
crumble:Play()
rockEmitter.Enabled = true
dustEmitter.Enabled = true
ts:Create(stand.Union, TweenInfo.new(5), {CFrame = stand.Union.CFrame * CFrame.new(4,0,0)}):Play()
wait(5)
rockEmitter.Enabled = false
dustEmitter.Enabled = false
crumble:Stop()
end)
crackPrompt.Triggered:Connect(function()
local tweens = {
ts:Create(light, TweenInfo.new(1), {Brightness = 2.5, Range = 45, Color = Color3.fromRGB(255, 180, 60)}),
ts:Create(amongus.Parent, TweenInfo.new(1), {Size = Vector3.new(500, 0.05, 500)}),
ts:Create(amongus.ImageLabel, TweenInfo.new(1), {ImageTransparency = 1}),
ts:Create(plunge, TweenInfo.new(5), {CFrame = plunge.CFrame * CFrame.new(0,1500,0)}),
ts:Create(source, TweenInfo.new(5), {CFrame = source.CFrame * CFrame.new(0,-1500,0)})
}
crackPrompt.Enabled = false
SWING:Play()
wait(1)
SWING2:Play()
RIFT_OPEN:Play()
wait(0.5)
BREAK:Play()
SHATTER:Play()
ts:Create(crack, TweenInfo.new(0.25), {Size = Vector3.new(0.001,0.001,0.001)}):Play()
wait(0.25)
shakeEvent:FireAllClients()
crack:Remove()
portal1.Enabled = true
portal2.Enabled = true
amongus.Enabled = true
water.Enabled = true
for i, tween in pairs(tweens) do
tween:Play()
end
ambience:Play()
pulse:Play()
end)