How to disable an imagebutton when the player enters a specific area

So I have this image button (ScreenGui>Frame>ImageButton>Script), where if you click on it, your plater will be able to sprint (and the imagebutton’s background color will change to green), now I want to make it so that if you enter a specific area this button has an X on top of it and it won’t work unless you exit this area, even if you click it, it won’t change colors (won’t turn into green like normally). How do I make such thing?

NOTE: The imagebutton’s zindex is 2 since there is also a textlabel and an imagelabel on it too (which have a zindex of 1), see picture below.

-How the imagebutton looks like normally:
Screenshot_26

-How the imagebutton looks like when clicked (and if you click it again it will go back to normal):
Screenshot_27

-Explorer view:
Screenshot_25

The script (not local) inside the imagebutton:

running = false

script.Parent.MouseButton1Click:Connect(function()
	local char = script.Parent.Parent.Parent.Parent.Parent.Character
	if running == false then
		running = true
		char.Humanoid.WalkSpeed = 24
		script.Parent.BackgroundColor3 = Color3.fromRGB(68, 204, 100)
	elseif running == true then
		running = false
		char.Humanoid.WalkSpeed = 16
		script.Parent.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
		script.Parent.BackgroundTransparency = 0.8
	end
end)
1 Like

Bumping this because I am still stuck on it :cry: