I’m redoing a plot system I created a long time ago for my current project. I’m trying to detect if when the MouseEnter event is fired. I’m not sure why but my script just doesn’t do anything when my mouse enters the TextButton with the elseif statement in the loop. Does anyone know why?
local player = game.Players.LocalPlayer
local plotHolder = workspace.Plots
local gui = player:WaitForChild("PlayerGui"):WaitForChild("gui")
local plots = gui.plotSelect.holder
local frame = gui.plotSelect
local clientServer = game.ReplicatedStorage.clientServer
for holder,plot in pairs(plots:GetChildren()) do
if plot.ClassName == "TextButton" then
plot.MouseEnter:Connect(function()
local selPlot = tostring(plot.Name)
local match = plotHolder:FindFirstChild(selPlot)
local outline = match:WaitForChild("select")
if match:WaitForChild("Owner").Value == "" then
outline.Visible = true
elseif match:WaitForChild("Owner").Value ~= "" then
outline.Color3 = Color3.fromRGB(222, 54, 54)
outline.Visible = true
plot.MouseLeave:Connect(function()
local selPlot = tostring(plot.Name)
local match = plotHolder:FindFirstChild(selPlot)
local outline = match:WaitForChild("select")
if match and outline then
outline.Visible = false
plot.MouseButton1Click:Connect(function()
frame:TweenPosition(UDim2.new(0.5,0,1.5,0),"In","Bounce",1.25)
clientServer:FireServer("plotSelect", tostring(match))
end)
end
end)
end
end
end)
end
end