#how do i make it come from only one place

209 messages · Page 1 of 1 (latest)

cinder geode
#

it plays globally i do not want it to play globally....

supple breach
#

if you're playing it from a script it's going to play globally

#

you need to use a local script

#

or maybe fire a remote event to a client

cinder geode
#

oh

#

i feel foolish now

#

it still plays globally

#

globally like across the map i meant

#

maybe bad phrasing

next fern
#

if you place the sound in an object you can set the distance it plays

cinder geode
#

i did that and its still global

remote spruceBOT
#

studio** You are now Level 4! **studio

cinder geode
#

i can like stream or clip it if that helps

stuck swift
#

where do you wanna play it?

#

parent it to the workspace part and then play it

cinder geode
#

im trying to make it play from a radio

stuck swift
#

workspace part at the position where u want it to play

#

yes so parent the audio to the radio

#

play it

#

then wait till its finished n deletr it

cinder geode
#

what

#

okay

stuck swift
#

clone the audio

#

parent it to the part

cinder geode
#

uh huh uh huh

stuck swift
#

play it

cinder geode
#

yeah

stuck swift
#

see that

#

yes

cinder geode
#

like this or am i foolish

#

@stuck swift

stuck swift
#

yes

#

like that

cinder geode
#

yeah

stuck swift
#

did it work?

#

is that in the workpsace

cinder geode
#

emmm

#

its in a folder

#

do i gotta take it out of the folder

#

it is now in the workspace and not in the folder

supple breach
#

the part can be in a folder just make sure ur playing the audio that's a child of the part and not the ones that are a child of the script

cinder geode
#

ok

#

the ones in the script are not playing and the ones out of the script are playing

#

it is just playing every song at once am i foolish

supple breach
#

did you set the sounds themselves to looped by chance

#

or isplaying

cinder geode
#

they are on isplaying and not on looped

supple breach
#

if they start isplaying then they'll just go

#

u can turn that off to start with

cinder geode
#

ok

#

isplaying is off

supple breach
#

does it work

cinder geode
#

no

#

not at all

stuck swift
#

do something like


local audioFolder = …
local function playAudio()
local audio = nil
local randomNumber = math.random(1, 5) — or howveer many audios you have
for i, v in pairs(audioFolder:GetChildren()
if i == randomNumber then
audio = v
end
end

   local clonedAudio = audio:Clone()
   clonedAudio.Parent = - part you wanna parent it to
    clonedAudio:Play()
    clonedAudio.Ended:Wait()
    clonedAudio:Delete()

end


supple breach
#

so it's still playing all the songs at once or

cinder geode
#

playing nothing at all

stuck swift
supple breach
#

can i see the properties of the sound

#

and is the code any different from the first one u posted

cinder geode
#

the code is trhe same but its in a localscript now

supple breach
#

if it's the same then it would be playing the sounds that are children of the script

#

oh yeah and locks scripts won't work i. the workspace

#

local

cinder geode
#

what

supple breach
#

so put that in like starterplayerscripts or something

supple breach
# cinder geode

we're trying to play the sounds that are children of a part right

cinder geode
#

should i just turn it into a regular script again??

stuck swift
#

try my code aswell

supple breach
#

no put the script in starterplayerscripts

cinder geode
#

it is now in starterplayerscripts

supple breach
#

now can you show me a picture of the part in workspace where we have all the sounds

cinder geode
supple breach
#

duster is based

supple breach
stuck swift
supple breach
#

even better do workspace:waitforchild("radio")

stuck swift
cinder geode
#

are you sure it shouldnt be a normal script i wanted it to play the same song for everyone

#

would it not be random for everyone if it was a local script

supple breach
#

i thought you said you didn't want everyone hearing it

#

yeah make it a script the

cinder geode
#

i didnt want it to be played across the entire map that is the issue i have been having

supple breach
#

put it in like serverscriptservice or something

supple breach
cinder geode
#

yeah sorry

#

globally was a foolish term

supple breach
#

that's okay

cinder geode
#

so should i delete the old local script

supple breach
#

yeah

cinder geode
#

ok that part is done

supple breach
#

so what do you have now

cinder geode
#

uhh

#

like the same thing i took a screenshot of before but its a normal script in serverscriptstorage

#

got stuck on that sorry

stuck swift
#

is it working

supple breach
#

and radio still has all the sounds in it?

stuck swift
#

big cee

cinder geode
#

yeah hold on i never checked if it works

supple breach
#

you can delete all the sounds from beneath the script

cinder geode
#

and radio is exactly the same

#

it does not work there is still no audio

cinder geode
supple breach
#

cool

#

does it work

cinder geode
#

it does not

supple breach
#

any errors

stuck swift
cinder geode
#

how do i check that again

remote spruceBOT
#

studio** You are now Level 5! **studio

stuck swift
#

everytime it runs

remote spruceBOT
#

studio** You are now Level 4! **studio

cinder geode
#

idk what printing means to be honest

stuck swift
stuck swift
cinder geode
#

sorry sir

stuck swift
#

its okay big cee

#

youll learn

cinder geode
#

never coded before sir

supple breach
cinder geode
supple breach
#

print is basically a way to help debug

#

did you change the script to look for children of radio instead of children of the script

cinder geode
#

no hold on sorry i completely forgot

supple breach
#

that should fix it

stuck swift
cinder geode
#

it is exactly the same i dont think i did it right

stuck swift
#

show us line 4

cinder geode
#

uhh

supple breach
#

show the whole script

cinder geode
#

like in the output thing

#

ok

#

wait(1)
while true do
local Sounds = script:GetChildren()
local RandomIndex = math.random(1,#Sounds)
local RandomSound = Sounds[RandomIndex]
RandomSound:Play()
wait(RandomSound.TimeLength)
end
workspace.radio.getchildren()

supple breach
#

huh

cinder geode
#

i dnto know what im doing

supple breach
#

you see where it says local sounds

cinder geode
#

OH

#

oh

supple breach
#

we're trying to change that

cinder geode
#

i get it i get it

supple breach
#

we don't want Sounds to be the children of script we want it to be radio

cinder geode
#

yeah i think i get it now

supple breach
#

nice

cinder geode
#

radio is not a valid member of workspace

#

maybe i dont get it now

supple breach
#

is radio a child of workspace or a folder or something

remote spruceBOT
#

studio** You are now Level 10! **studio

cinder geode
#

child of workspace

supple breach
#

we need to properly reference the radio part

cinder geode
#

ok

#

nvm i was being silly with the code

#

it was not radio issue

supple breach
#

ok cool

cinder geode
#

wait(1)
while true do
workspace.radio.GetChildren() = script:GetChildren()
local RandomIndex = math.random(1,#Sounds)
local RandomSound = Sounds[RandomIndex]
RandomSound:Play()
wait(RandomSound.TimeLength)
end

#

this is what i put is this right

#

idk why its bringing up the fog part now

supple breach
#

uh u did something really weird

supple breach
#

with the workspace.radio:getchildren()

#

you know what a variable is right

cinder geode
#

tell me so i dont look foolish later

supple breach
#

like it's just a way to use shorthand so we don't need to type a lot of stuff

cinder geode
#

ok ok

supple breach
#

so instead of typing radio:getchildren() every time we can just type Sounds

supple breach
#

but instead for some reason you're trying to declare that radio:getchildren() should equal script:getchildren()

#

which is nonsensical

cinder geode
#

uh huh uh huh

supple breach
#

the fog part thing is from a different script entirely

cinder geode
#

yeah

supple breach
#

anyways

#

did you fix defining your variable

cinder geode
#

how do i do that...

supple breach
#

so i. the original code you had you were defining the Sounds variable as script:getchildren() because all the sounds were children of the script right

#

but we've changed that now so that the sounds are children of the workspace part

#

so instead we need to define Sounds as the children of the radio part

#

you see what i'm saying

cinder geode
#

i thnik so

#

let me try

#

I DID IT

stuck swift
#

YAY!

#

WELL DONE BIG CEE

#

WE’RE ALL SO PROUD OF YOU

cinder geode
#

maybe... i am stupid

#

that was a lot simpler than i thought it wsa

#

thank you both

stuck swift
#

its honestly extremely simple im ngl

#

idk how it took you so long

stuck swift
cinder geode
supple breach
#

let's gooo

#

i'm glad u got it hopefully u learned something

cinder geode
#

yeah i learned hella thank you both