I’m trying to make a button which triggers a RemoteEvent however whenever I click the MouseButton1Click do not fire. Why is this the case and what can I do to fix this?
.
Here's the script
local Rent = game:GetService("ReplicatedStorage").Customization.Rent
script.Parent.MouseButton1Click:Connect(function()
print ("hi") -- Does not print when clicked
Rent:FireServer(2)
end)
local button = script.Parent
local originalSize = button.Size
local originalPosition = button.Position
local scaleFactor = 1.05
local function onMouseEnter()
local newOffsetX = originalPosition.X.Offset - (originalSize.X.Offset * (scaleFactor - 1) / 2)
local newOffsetY = originalPosition.Y.Offset - (originalSize.Y.Offset * (scaleFactor - 1) / 2)
button.Size = UDim2.new(originalSize.X.Scale * scaleFactor, originalSize.X.Offset * scaleFactor, originalSize.Y.Scale * scaleFactor, originalSize.Y.Offset * scaleFactor)
button.Position = UDim2.new(originalPosition.X.Scale, newOffsetX, originalPosition.Y.Scale, newOffsetY)
end
local function onMouseLeave()
button.Size = UDim2.new(originalSize.X.Scale, 0, originalSize.Y.Scale, 0)
button.Position = UDim2.new(originalPosition.X.Scale, 0, originalPosition.Y.Scale, 0)
end
button.MouseEnter:Connect(onMouseEnter)
button.MouseLeave:Connect(onMouseLeave)
.
And here's the hierarchy and "proof" of the button being active
.
Notes:
- The button is active
- I have tried MouseButton1Down as well to no avail
- Nothing is outputted into the output (including “hi”)