Hi there! So what I am trying to do is display an Image on an Image Label, thing is, everything works in Studio testing but not when im actually in the game.
Below are the first scripts, reminder, they work in studio but not in-game
Script 1 in StarterGui
script.Parent.Board_1.TextButton.MouseButton1Click:Connect(function()
local Image = workspace.White_Boards.White_Board_1.SurfaceGui.ImageLabel
Image.Image = "rbxassetid://".. script.Parent.Board_1.ID.Text
end)
Script in StarterPlayerScripts
local Players = game:GetService("Players")
local GUI = Players.LocalPlayer.PlayerGui:WaitForChild("Board_1")
local Click_1 = workspace.White_Boards.White_Board_1:WaitForChild("ClickDetector")
Click_1.MouseClick:Connect(function()
print("Clicked")
GUI.Enabled = true
end)
You have to use FilteringEnabled for it to work in a game. You’re making adjustments to the server through the client and that’s not allowed. You must have the server change the image. I believe this might be of use for you.
Yes, but it’s still making adjustments to the server through the client so it won’t be visible to other players, it’ll only be visible to him. I’m not sure if that’s what he wants, as he didn’t specify.
You cannot make game.Players.LocalPlayer a variable in a server-sided script. You can also not detect MouseClick from a ClickDetector through a client-sided script. There is a way you can enable a GUI for a player when a ClickDetector is clicked, and I’ve shown a quick example below.
local function click(player)
local GUI = player.PlayerGui:WaitForChild("Board_1")
print("Clicked")
GUI.Enabled = true
end
local Click_1 = workspace.White_Boards.White_Board_1:WaitForChild("ClickDetector")
Click_1.MouseClick:Connect(click)
For this to occur, one of three things must have happened.
FilteringEnabled wasn’t used. For this, search the DevForum for posts using FilteringEnabled.
Team Create scripts weren’t applied. For this, go into the settings of your game and turn team create off or right click on all your scripts from the top bar and click apply edits.
You used the wrong type of script. For this, always use a LocalScript. In some cases you can use a regular Script, but I wouldn’t worry about trying to mess with that.