Hello. I’m trying to make a changeable picture in a frame. How it works is that there is a GUI in the picture frame, and it gets cloned to the player GUI, and there is a TextBox, where you can input the ID and press submit.
PROBLEM:
When the GUI textbox makes changes, they’re only clientside, so the server wont see that. If i were to use a RemoteEvent and use :FireServer() event, how would I let the server know, which picture frame to change?
You can try this:
Only change the variables to their original objects.
And use a removeFunction.
LocalScript:
local textBox = script.Parent.TextBox
local image = script.Parent.ImageLabel
local remote = script.Parent.RemoteFunction
local oldId = nil
local bool = true
while wait() do
local id = tonumber(textBox.Text)
if bool and id and oldId ~= id then
bool = false
oldId = id
remote:InvokeServer(image, id)
bool = true
end
end
Script:
local remote = script.Parent.RemoteFunction
remote.OnServerInvoke = function(plr, image, id)
pcall(function()
image.Image = “rbxassetid://” … id
end)
end
You can’t pass instances through a remote event, so I don’t think passing the imageLabel like that would work.
What you’d probably need to do is to give each image label a unique ID.
Then pass the ID of the image label in the remote event.
Your server side code then find the label with this ID and can change it