#i need help with a music changing script

114 messages · Page 1 of 1 (latest)

barren forum
#

idk whats wrong i did the exsact same thing with another one of my scripts. this is what i did with another one of my scripts and it works

    if game.Players.LocalPlayer ~= game.Players:GetPlayerFromCharacter(hit.Parent) then return end

    game.Lighting:WaitForChild("Sky"):Destroy()
    game.Lighting:WaitForChild("Atmosphere"):Destroy()
    game.Lighting:WaitForChild("ColorCorrection"):Destroy()
    game.Lighting.Other.Wartwood.Sky:Clone().Parent = game.Lighting
    game.Lighting.Other.Wartwood.Atmosphere:Clone().Parent = game.Lighting
    game.Lighting.Other.Wartwood.ColorCorrection:Clone().Parent = game.Lighting
end)```  im not sure why it's not changing the music though for the script in the forums desc when i change it for that
#

please ping me

west idol
#

@barren forum

#

Can i see your music change script

barren forum
#

sure

#
game.Workspace.Particles:WaitForChild("MagicalDust1").Touched:Connect(function(hit)
    if game.Players.LocalPlayer ~= game.Players:GetPlayerFromCharacter(hit.Parent) then return end
    game.Workspace.MainMusic.CurrentMusic.SoundId = "rbxassetid://1844812924"
end)```
west idol
#

Is "MagicalDust1" a particle emitter

barren forum
west idol
#

And is your script local or not

teal inletBOT
#

studio** You are now Level 1! **studio

barren forum
#

local

#

and it's in starter character scripts

west idol
#

Give me a minute

#

I dont think its a script error it should work perfectly fine if "MagicalDust1" is a part

#

Its probably an audio error because of the new audio update

#

The audio needs to be made by you

#

And then granted permission from output

west idol
#

But you still need to grant permission

barren forum
#

oh i didn't get that in output?

teal inletBOT
#

studio** You are now Level 1! **studio

barren forum
#

it's a roblox sound would that also do that?

#

@west idol ( sorry for the ping i just want to get ur attention )

west idol
#

Like the script works perfectly fine i checked it right now

#

So it 100% isnt an issue with the script or so i think

barren forum
#

oh

west idol
#

The only thing that you should also do is

#

game.Workspace.MainMusic.CurrentMusic.Playing = true

#

Right under the soundid

barren forum
#

i don't have can query on the part thingy would that do anything?

west idol
#

It shouldnt affect it

barren forum
#

ok

west idol
#

Can query is for raycasts which are different

west idol
#

If not try game.Workspace.MainMusic.CurrentMusic:Play()

#

If that also doesnt work its probably something with the audio

barren forum
#

well it's playing music just not of the id i want, it's just playing the music thats there and i've checked the id's and it's the correct one

west idol
#

Weird

barren forum
#

i have the sound looping would that do anything?

#

do i need to stop it then play?

west idol
#

Though i tested like

#

I made a song play without the script

west idol
#

To change to the 2nd song

teal inletBOT
#

studio** You are now Level 2! **studio

west idol
#

And it still worked

barren forum
#

weird

#

is there another way to do this?

west idol
#

Well if you want to put in more work do two different audios

#

And if you touch the part

#

Then audio 1 stops

#

And audio 2 plays

barren forum
#

oh, i don't think i can do that cause it will mess with my settings system 😭

#

would remote events work?

#

or if do it through the block?

teal inletBOT
#

studio** You are now Level 2! **studio

barren forum
#

like put the script in the block and try it there

west idol
#

It should work just fine as a local script except it would only play locally and not for the whole server

barren forum
#

oh thats fine

#

i don't think the script is even triggering

#

i see nothing in output

west idol
#

Check with print

#

Just add something like print("a")

#

And see if it prints once you touch

slender phoenix
#

canquery needs to be true for .Touched iirc

barren forum
#

really

#

let me try that

#

it didn't work it also didn't print anything

#

im going to try smth brb

slender phoenix
#

o wait is CanTouch true?

barren forum
#

ye

slender phoenix
#

hmmm

barren forum
slender phoenix
#

part is anchored and general stuff like that?

barren forum
#

yes i also have it so i can see it

#

so it's not transparent

#

it has can collide off would that do anything?

slender phoenix
#

nope

#

i have no clue tbh

barren forum
#

here aer some pics

#

*are

#

the game is also reallllly big idk if that would do anything?

#

here is my output

slender phoenix
#

big parts shouldnt be an issue a map in a game im working on has a similar system and the parts are huge

#

although it uses getpartsinpart rather than touched

barren forum
#

oh

#

this is really annoying me 😭 i've already spent 1 full day trying to fix it

#

it's probably something so obvious and I'm going to feel so dumb when i find it lol

teal inletBOT
#

studio** You are now Level 3! **studio

slender phoenix
#

i think i see the issue maybe

#

you're only detecting when magicaldust1 is touched

#

and none of the others

barren forum
#

well i have the others in the script

    if game.Players.LocalPlayer ~= game.Players:GetPlayerFromCharacter(hit.Parent) then return end

    game.Workspace:WaitForChild("MainMusic").CurrentMusic.SoundId = "rbxassetid://1837403780"
end)

game.Workspace.Particles:WaitForChild("MagicalDust2").Touched:Connect(function(hit)
    if game.Players.LocalPlayer ~= game.Players:GetPlayerFromCharacter(hit.Parent) then return end
    
    game.Workspace:WaitForChild("MainMusic").CurrentMusic.SoundId = "rbxassetid://1837403780"
end)```
slender phoenix
#

oh do you ever actually play the song after changing the id

barren forum
#

a song is playing just not the one i want

#

it's playing the one you begin with and yes i have checked the codes

slender phoenix
#

then your id prob wrong

#

o

#

try stopping and restarting the sound after changing the id

barren forum
#

i've already done that but i can try that again

#
    if game.Players.LocalPlayer ~= game.Players:GetPlayerFromCharacter(hit.Parent) then return end
    game.Workspace:WaitForChild("MainMusic").CurrentMusic:Stop()
    game.Workspace:WaitForChild("MainMusic").CurrentMusic.SoundId = "rbxassetid://1844812924"
    game.Workspace:WaitForChild("MainMusic").CurrentMusic:Play()
end)
``` should i do it another way?
barren forum
# barren forum

would have alot of other scripts in the script interfer with it?

#

this is the full script but the scripts aboves don't relate to the script that i have a problem with

#

i could try seperating the scripts if thats a problem?

#

WHAT THE BLORB THAT WAS THE PROBLEM

#

HOOOOOOOOOOOOOW

#

thank you for your help guys