I am trying ot make a gui that highlights the gui the mouse is in,but it does not function or even produce an error Here is what my code reads:
local children = script.Parent:GetChildren() for i,v in pairs(children) do if v:IsA("TextButton") then v.MouseEnter:connect(function() v.BorderSizePixel = 1 v.BorderColor3 = Color3.new(0,255,255) end) v.MouseLeave:connect(function() v.BorderSizePixel = 0 end) v.MouseButton1Click:connect(function(clicked) clicked.BorderSizePixel = 1 clicked.BorderColor3 = Color3.new(0,255,255) end) end end
--UPDATED and FIXED
This is your main script you showd:
--You have such a mess here o.o local children = script.Parent:GetChildren() for i,v in pairs(children) do if v:IsA("TextButton") then local sr=script.MouseFunctions:Clone() sr.Parent=v sr.Disabled=false end end
Now make a script that is disabled inside that script called MouseFunctions:
local D=false --What i realized is that your no-organization made your script eventually break... script.Parent.MouseEnter:connect(function(x,y) -- This script is inside the textbuttons -- for higher chance of working script.Parent.BorderSizePixel = 1 script.Parent.BorderColor3 = Color3.new(0,255,255) end) script.Parent.MouseLeave:connect(function(x,y) -- X and Y are a property of MouseLeave and MouseEnter if D==false then script.Parent.BorderSizePixel = 0 end end) script.Parent.MouseButton1Click:connect(function(clicked) D=true script.Parent.BorderSizePixel = 1 script.Parent.BorderColor3 = Color3.new(0,255,255) -- clicked is Mouse :_: u cant change Mouse's BorderSizePixel . . . end)
Add a new ClickDetector into main script's Parent.
Hope this helps! If not tell output! ~marcoantoniosantos3