#How to make that when pressing on GUI sound will start playing
1 messages · Page 1 of 1 (latest)
k
`local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local soundsFolder = ReplicatedStorage:WaitForChild("Sounds")
button.MouseButton1Click:Connect(function()
local template = soundsFolder:FindFirstChild("Netherlands")
if template then
local sound = template:Clone()
sound.Parent = workspace
sound:Play()
sound.Ended:Connect(function()
sound:Destroy()
end)
else
warn("Sound 'Netherlands' not found in Sounds folder.")
end
end)
`
maybe because you set the sound's parent to workspace and not to the button?
do i have to move my sound in button?
yea because you are setting the sound's pattern to the workspace and not the button
ok 1 sec
sound.Parent = button
`local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local soundsFolder = ReplicatedStorage:WaitForChild("Sounds")
button.MouseButton1Click:Connect(function()
local template = soundsFolder:FindFirstChild("Netherlands")
if template then
local sound = template:Clone()
sound.Parent = button.Netherlands
sound:Play()
sound.Ended:Connect(function()
sound:Destroy()
end)
else
warn("Sound 'Netherlands' not found in Sounds folder.")
end
end)`
still didnt work
k
since you are already setting the button in "button = script.Parent"
ughh it still doesnt work
does the warn show
no
local soundsFolder = ReplicatedStorage:WaitForChild("Sounds") its like this
there was sounds
but i moved 1 sound that i needed
in button
does it have to do something?
why not just putting the sound inside the button and when m1 happens it just plays?
** You are now Level 9! **
why not just putting the sound inside the button and when m1 happens it just plays?
and how should i do that?
its not part btw its on gui
lemme test something
and yes its inside a part
script.Parent.MouseButton1Click:Connect(function()
local sound = script.Sound:Clone()
sound.Parent = script.Parent.Parent.Parent
sound:Play()
if sound.Ended == true then
sound:Destroy()
end
end)
there
@south iris it still doesnt work
i mean i changed some things
my text button is in Scrolling Gui
so it needs four parents yes?
OH WAIT
IT WORKED
LOL
yea, till you get to the part
TYSM
np
if you need anything lmk
lol
np
tysm again
@south iris how to make that when 1 button is pressed its playing, but as soon as other button will get pressed first pressed button will stop functioning and other pressed button will start functioning
bit hard but idk how to do it
Give me a sec and i help you
im definetly giving u credit
also IDK how to make so good like this
mine looks like this HELP-
Could u elaborate on what u mean
Theres 1 part. On that part theres surfacegui, in surface gui theres many text buttons. I mace that when you press button (for example france text button) song will start playing. But i want to make that when france music is being played and when i press other button, france music will stop playing and other pressed button music will start playing
Sure
@agile dove
sound under script is all same in other textButtons
just names changed
to country
for example: Netherlands TextButton, Sound is called Netherlands too
k
I can give u a script tomorrow, because it’s past midnight for me rn and I’m not on my pc currently
This should work (hopefully🤞)
Put in a local script inside of your EurovisionGui
Let me know if you have any questions about it or if it doesn't work like it should
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh i already did it :DD
@agile dove
but can u help me with 1 thing?
how can i make like that? its so high
mine looks so cheap 😭
no like that
First of all did u set lightning to realistic
** You are now Level 11! **
wym
no i mean its more smoother
they probably use tweens
can u tell me how to make it
u might only have realistic if ur project is older
uhhhhh ok ig
i dont have realistic there-
what options do u have
future shadow voxel
future is best
good
and wdym by tweens?
tweenservice
probably
--[[
The parts in the Target Folder must contain numbered parts to maintain order
The numbering must start from 1
The parts need to be named in the order that they are in, for example if it's the first part then it will be named 1
]]--
local Left = script.Parent.Left -- The folder with the parts
local LeftElements = Left:GetChildren() -- The table of the parts
local EmptyGridColor = Color3.new(0, 0, 0) -- Color of the emptys (obviously)
local TargetColor = Color3.new(1, 0, 0) -- Color of the center or segments
local BodyLength = 5 -- Length of the body
local HalfLength = math.floor(BodyLength/2)
while true do
for i = 1, #LeftElements + BodyLength do -- << reversed direction (from top to bottom)
-- Clear colors
for i = 1, #LeftElements do
Left[i].Color = EmptyGridColor
end
local Center = i - HalfLength
-- Below center
for j = Center - HalfLength, Center do
local Segment = Left:FindFirstChild(tostring(j))
if not Segment then continue end
Segment.Color = EmptyGridColor:Lerp(TargetColor, j / (Center - HalfLength))
end
-- Above center
for j = Center, Center + HalfLength do
local Segment = Left:FindFirstChild(tostring(j))
if not Segment then continue end
Segment.Color = TargetColor:Lerp(EmptyGridColor, j / (Center + HalfLength))
end
-- Center segment
local CenterSegment = Left:FindFirstChild(tostring(Center))
if CenterSegment then
CenterSegment.Color = TargetColor
end
task.wait(0.07)
end
task.wait()
end
this is script im using
for that
but it looks so cheap compared to that video
did u make this code?
Me and my friend