I’m trying to make a script that changes a image buttons image depending on the decal ID inputted into a textbox.
The script doesn’t change the image properly, even if I use the link that works in studio.
Video: Video Link
As you can see in the video, it works if I manually input the ID into the image box as normal, but if I do the same thing in a script, it doesn’t work, even if I use the exact same manual path.
I’ve tried removing the “http://www.roblox.com/asset/?id=” part, and just having the script enter the Decal ID, but that didn’t work. I’ve also tried using “rbxasset://” and then the ID, with still no success.
Code:
--Server side script
game.StarterGui.DisplayADsGUI.Frame.Placeholder.Image = "http://www.roblox.com/asset/?id="..script.Parent.AdvertismentFolder.Promotion1.DecalID.Value -- Simply tries to switch the current GUI image for one stored in a INTValue, but it fails to do it properly.
That’s because you’re trying to modify the StarterGui from a local script once the game has started. Instead reference the correct UI element using script.Parent for example.
I’m using a server script cause I just shoved it into the script which determined what ID to use, but I could try using a remote event and use a local script.
I just used
game.Players.PlayerAdded:connect(function(player)
It didn’t return an error with defining the player, the image just showed up blank.
Just tried a local script, and it still didn’t work. It works if I manually enter it by going into the playerGUI folder and then entering the ID, but not in a script.
What about remote events? Get the player to input the image ID, then to click a send button, then fire the image id through a remote event to the server and slap it onto the image button.
i see you placed a .Value there. If the value is integer/ number value, try to add tostring(Path to the value.Value)
To qoute message:
I think you should really used an remote events because when a user type something in the textbox, it only changes the client. So in the server its “” (Context text)/cleared text.