Can't change an Image ID through a TextBox? - Turns into a string

  1. What do you want to achieve? Keep it simple and clear!
    I want to be able to change an Image ID through a textbox!
  2. What is the issue? Include screenshots / videos if possible!
    I have turned the Textbox to a number but it is still a string.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried friends advice, videos.
script.Parent.MouseButton1Click:Connect(function()
	local ImageID = tonumber(script.Parent.Parent.ImageID.Text)
	
	game.Workspace.Logo1.Decal.Texture = "http://www.roblox.com/asset/?id=" .. ImageID
	game.Workspace.Logo2.Decal.Texture = "http://www.roblox.com/asset/?id=" .. ImageID

end)

try

"rbxassetid://" .. ImageID

Alright [Added this because of max limit]

It did not work, not sure what to do now.

script.Parent.MouseButton1Click:Connect(function()
	local ImageID = script.Parent.Parent.ImageID.Text
	
	game.Workspace.Logo1.Decal.Texture = "rbxassetid://" .. ImageID
	game.Workspace.Logo2.Decal.Texture = "rbxassetid://" .. ImageID

end)

I did that, it did nothing. I tried the exact same code

Make sure your script is a localscript.
Since server scripts can’t get textbox input from a client, if you want to send textbox text to the server then use remote events.

1 Like

In addition to the previous reply, can you provide the ID of the decal that you’re attempting to test with?

This was a part of my game, you might have to change it a bit to get it to work for your game (Ik it looks horrendous to look at, but I made it when I was starting :grin:) :

local MarketPlace = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local Service = game:GetService("GamePassService")
local BackgroundLinkHolder = script.Parent.Parent.Parent.PaidLinkBack.TextBox
script.Parent.MouseButton1Click:Connect(function()
game.StarterPlayer.StarterPlayerScripts.Sounds.MouseClick:Play()
game.StarterPlayer.StarterPlayerScripts.Sounds.MouseClick.TimePosition = 1
if Service:PlayerHasPass(player, GamePassId) then
script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Image = string.format("rbxthumb://type=Asset&id=%s&w=768&h=432", BackgroundLinkHolder.Text)
else
MarketPlace:PromptGamePassPurchase(player, GamePassId)
warn(player.Name .. "does not have the gamepass")
end
end)
1 Like