The conditional is evaluated upon runtime; your if-statement will not evaluate the expressions again unless programmed to.
To do so, we can use the GetPropertyChangedSignal method of the Instance base-class. This will allow us to provide a callback for when the specified property changes:
Regarding "Global 'PlayerGui'":
The WaitForChild method of Instance expects a String, by syntax context, it's assuming you're trying to reference a variable.
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local LevelGui = PlayerGui:WaitForChild("level")
local LevelFrame = LevelGui:WaitForChild("Frame")
local ImageLabel = LevelFrame:WaitForChild("ImageLabel")
local ImageText = LevelFrame:WaitForChild("imagetext")
local TextureObject = script.Parent
local function AdjustImage()
if (TextureObject.Texture == "rbxassetid://5651929240") then
ImageLabel.Image = TextureObject.Texture
ImageText.Text = "This Image is called \"65-WAT meme\""
end
end
TextureObject:GetPropertyChangedSignal("Texture"):Connect(AdjustImage)
####Note:
It's a poor practice to leave Instances un-named or named without context. I suggest you give better handles to your Objects, additionally formatted in CameCase. Ensure consistency is applied.
1 comment
also see this https://scriptinghelpers.org/questions/112667/is-it-possible-to-get-this-script-to-save-on-a-1-player-server