How do i set Imagelabel ImageRectOffset Property in a proper way?

imagerectoffset needs a vector2 value and i did it that way and it seems to have errors.

local rpos = Vector2.new(923,685)
local wpos = Vector2.new(84,565)
local E = true
local function K()
	local hum = plr.Character.Humanoid
	E = not E -- acts like switch
	rimage.ImageRectOffset = E and rpos or wpos
	hum.WalkSpeed = E and 16 or 96
end
Tb.Activated:Connect(K)

Players.Angrybirdcharacter.PlayerGui.Gui.Main:34: attempt to index string with 'ImageRectOffset'

any help?

1 Like

try using an if statement - the code may be trying to set the ImageRectOffset to a combination of e and rpos

if e and rpos then
   rimage.ImageRectOffset = rpos
elseif wpos then
   rimage.ImageRectOffset = wpos
end
2 Likes