Help with a custom vignette changer

I’m making a custom vignette changer.
When I put in an ID, it doesn’t change the vignette to the inputted id.

image

Script to set the image to the inputted id:

local textbox = script.Parent.Parent.TextBox

local ImageChangerreal = game:GetService("ReplicatedStorage"):WaitForChild("ChangeImage")

script.Parent.MouseButton1Click:Connect(function()
	local id = textbox.Text
	if id == "" then
		warn("YOU FORGOT TO PUT AN ID IN!!")
	else
		
		if ImageChangerreal then
			ImageChangerreal:Fire(id)
		end
		print("got it")
	end
end)

And this is the script to show/paste the id in.

local rep = game:GetService("ReplicatedStorage"):WaitForChild("ChangeImage")

rep.Event:Connect(function(id) -- This part is problematic.
	script.Parent.Image = "rbxassetid://"..id
end)

local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(i, c) -- This part is completely fine.
	if i.KeyCode == Enum.KeyCode.J then
		if c then return end
		script.Parent.Parent.Visible = not script.Parent.Parent.Visible
	end
end)

Any help will be appreciated.

You could add heavy debug statements

local textbox = script.Parent.Parent.TextBox

local ImageChangerreal = game:GetService("ReplicatedStorage"):WaitForChild("ChangeImage")

script.Parent.MouseButton1Click:Connect(function()
	local id = textbox.Text
	if id == "" then
		warn("YOU FORGOT TO PUT AN ID IN!!")
	else
		
		if ImageChangerreal then
		  print("MouseButton1Click: "..id)
			ImageChangerreal:Fire(id)
		end
		print("got it")
	end
end)
local rep = game:GetService("ReplicatedStorage"):WaitForChild("ChangeImage")

rep.Event:Connect(function(id) -- This part is problematic.
  print("Connection Event: ".. id)
	script.Parent.Image = "rbxassetid://"..id
end)

local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(i, c) -- This part is completely fine.
	if i.KeyCode == Enum.KeyCode.J then
		if c then return end
		script.Parent.Parent.Visible = not script.Parent.Parent.Visible
	end
end)

It still doesn’t work? I have no idea why. I pasted in the code that you wrote but it still shows a blank image.

Yes, what is being shown in the output? It will help us with debugging the issue.

image
did it multiple times to be sure

Weird, maybe you can try and convert the string to a number… no clue

local rep = game:GetService("ReplicatedStorage"):WaitForChild("ChangeImage")

rep.Event:Connect(function(id) -- This part is problematic.
  print("Connection Event: ".. id)
	script.Parent.Image = "rbxassetid://"..tonumber(id)
end)

local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(i, c) -- This part is completely fine.
	if i.KeyCode == Enum.KeyCode.J then
		if c then return end
		script.Parent.Parent.Visible = not script.Parent.Parent.Visible
	end
end)

Tries to fix it with roblox studio’s AI but to no avail.
Both scripts are Local Scripts though and I’m using a BindableEvent since I’m doing the client-client.

Are you positive that you the assetid you are putting in exists? Is it verified? Could you try and do a different assetid?

this is because roblox has a stupid, this issue is really dumb and i still don’t understand why this isn’t fixed

you’re gonna have to do:

string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", Id)

do note that the minimum resolution is 150x150, and the maximum is 420x420

if you do not want to do this stupid string format thing, you’re gonna have to store the vignette somewhere and clone it whenever it’s needed

this issue will happen on every single image label if you try replacing its image at runtime, i don’t know why

1 Like

If this is the solution i’m going to lose it, every time i set my image to an Image Asset in my game i am always able to do it without doing that? If this is the solution its good to know in the future.

idk if this is a bug, i just know you need to do that string.format thing

or you need to use an image, rather than a decal
idk

1 Like

Stupid question but, where do I put this? ;D

imageLabel.Image = string.format(...)

image
dawg relax

1 Like

lol wqjbhdjqnbödqwydgvqwhd
srry abt that