Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change a Player's GUI depending on a property?

Asked by 4 years ago

I'm currently working on a GUI that shows the player what song is currently playing. I have gotten a Sound object with a script that keeps changing the song, and it works just fine. And I've also done a GUI in StarterGui that shows everything.

I have a Gui, Frame and TextLabel, inside the TextLabel is a script, that should change the player's GUI based on that property, this is how it looks like:

01--\\ VARIABLES
02 
03local sound = game.Workspace.Misc.PlaySongs
04local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
05local text = playerGui.CurrentSong.Frame.SongName
06 
07--// VARIABLES
08 
09--\\ CHANGER
10 
11if sound.SoundId == 3734646965 then
12    text.Text = "Buttercup"
13elseif sound.SoundId == 1560173003 then
14    text.Text = "Oh Klahoma"
15elseif sound.SoundId == 3524204087 then
View all 23 lines...

But it doesn't change anything, I've tested it with a print("") as well, for some reason it does not see when the property is changed. Any help would be greatly appreciated! Thanks!

0
I am having the same exact issue as you as well, except when reading the value of a StringValue User#35964 0 — 4y
0
I have the answer,i am typing it yuni_Boy1234 320 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

REMEMBER: the songs not only are composed with the id! they have an extension also "rbxassetid" look:

01--\\ VARIABLES
02 
03    local sound = game.Workspace.Misc.PlaySongs
04    local text = script.Parent
05 
06    --// VARIABLES
07 
08    --\\ CHANGER
09     while true do
10         wait(0.1)
11    if sound.SoundId == "rbxassetid://3734646965" then --Convert the number value to string --value
12        text.Text = "Buttercup"
13    elseif sound.SoundId == "rbxassetid://1560173003" then     
14           text.Text = "Oh Klahoma"
15    elseif sound.SoundId == "rbxassetid://3524204087" then
View all 24 lines...

I also highly recommend to shorten the song list part,you will need it

And change the script to server script, not local

0
I've done this and it still doesn't change my text, thank you for reminding me of the rbxassetid:// thing, but even when it is put like that the GUI doesn't change it's text, could it be a problem in the playerGui where it doesn't identify it? OrdinaryTeaCup 0 — 4y
0
I've also recorded and posted that the script has no errors or anything and the music playing and all that, here's the link, maybe it help with finding the problem? https://streamable.com/4finm7 OrdinaryTeaCup 0 — 4y
0
Try to change the local script to a server script yuni_Boy1234 320 — 4y
Ad

Answer this question