I made a model and added the ClickDetector in one of the part in there that can be clickable. Well, I put the position and size and the id for it to make the picture pop up after I click it. But apparently it didn't work. This is the script:
local song1 = game.Workspace.BoxCD.song1 local gui = game.StarterGui local screen = Instance.new("ScreenGui", gui) local image = Instance.new("ImageLabel", screen) touch = false function onClicked() if not touch then touch = true image.Position = UDim2.new({0, 300}, {0, 100}) image.Size = UDim2.new({0, 450}, {0, 400}) image.Image = "rbxassetid://238387775" touch = false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I hope what I asked and explain is understandable.
When using UDim2 in a script, the arguments do not need {}'s like it shows in properties. UDim2.new(XScale, XOffset, YScale, YOffset)
are the correct arguments.
Also, you need to place GUIs in the player's PlayerGui if you want them to be able to see the image. MouseClick
has a parameter for the player who clicked the ClickDetector. Place the GUI in their PlayerGui.
local song1 = game.Workspace.BoxCD.song1 local gui = game.StarterGui local screen = Instance.new("ScreenGui", gui) local image = Instance.new("ImageLabel", screen) touch = false function onClicked(clicker) --clicker is the argument for the player who clicked the button if not touch then touch = true local screen = Instance.new("ScreenGui", clicker.PlayerGui) --Place the Gui inside their PlayerGui in order for them to see it. local image = Instance.new("ImageLabel", screen) image.Position = UDim2.new(0, 300, 0, 100) image.Size = UDim2.new(0, 450, 0, 400) image.Image = "rbxassetid://238387775" touch = false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
If I helped you, be sure to accept my answer! :D