Skip to content
View STGamer24YT's full-sized avatar

Block or report STGamer24YT

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
STGamer24YT/README.md

About me

  • I use Luau to make Roblox games
  • I'm studying JavaScript (and I already hate it)
  • I usually check issues in geode-sdk/geode
  • I know how to use Batch, and I make the code unnecessarily ugly :trollface:

Module for playing sound in Roblox

PlaySound.lua
-- // important // --
local tweenservice = game:GetService("TweenService")
local audio = nil

-- // get the player that is calling the functions //
local plr = game:GetService("Players").LocalPlayer

-- // this music is stored in ReplicatedStorage //
local MainMusic = game:GetService("ReplicatedStorage").sound.Main:GetChildren()
local GameMusic = game:GetService("ReplicatedStorage").sound.Game:GetChildren()

-- // code to fade in and out audio //
local inTweenInfo = TweenInfo.new(
	1, Enum.EasingStyle.Sine, Enum.EasingDirection.In
)
local outTweenInfo = TweenInfo.new(
	0.7, Enum.EasingStyle.Sine, Enum.EasingDirection.Out
)

local iTween = tweenservice:Create(audio, inTweenInfo, {Volume = 0.5})
local oTween = tweenservice:Create(audio, inTweenInfo, {Volume = 0})

-- // function used by play() //
local fadeAudio = function(scope)
	if scope == "in" then
		iTween:Play()
		return
	elseif scope == "out" then
		oTween:Play()
		task.wait(0.7)
		return
	else
		print("oops :trollface:")
		return
	end
end

-- // module // --
local func = {}

func.MainMusic = MainMusic
func.GameMusic = GameMusic

-- // play audio //
func.play = function(scope)
	if audio ~= nil then -- if audio exists, destroy it
		fadeAudio("out")
		audio:Destroy()
		print("stopped!")
	end
	
	local selectedmusic = {}
	
	if scope == func.MainMusic then 
		selectedmusic = MainMusic
	elseif scope == func.GameMusic then
		selectedmusic = GameMusic
	else
		return "Error! Invalid Scope !{ module.game or module.map }!"
	end
	
	local rnd = math.random(1, #selectedmusic)
	task.wait(.1)
	
	audio = selectedmusic[rnd]:Clone()
	audio.Parent = plr:FindFirstChild("SoundPlace")
	audio:Play()
	fadeAudio("in")
	print("played!")
end

return func

Pinned Loading

  1. geode-sdk/geode Public

    The ultimate Geometry Dash modding framework

    C++ 825 138

  2. HJfod/BetterEdit Public

    Makes the Geometry Dash Editor Better

    C++ 153 41

22 contributions in the last year

Contribution Graph
Day of Week March April May June July August September October November December January February March
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Less
No contributions.
Low contributions.
Medium-low contributions.
Medium-high contributions.
High contributions.
More

Activity overview

Contributed to STGamer24YT/STGamer24YT, geode-sdk/geode, HJfod/BetterEdit and 1 other repository
Loading A graph representing STGamer24YT's contributions from March 24, 2024 to March 27, 2025. The contributions are 63% commits, 16% pull requests, 16% issues, 5% code review. 5% Code review 16% Issues 16% Pull requests 63% Commits

Contribution activity

March 2025

STGamer24YT has no activity yet for this period.
Loading