Problem: I have tried to make a click effect on a UI, but when I click on the button, the effect does appear. Anyone know how to fix this?
Script:
local player = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local mainMenuFrame = player.PlayerGui:WaitForChild("MainMenu").MenuFrame
local TweenInformation = TweenInfo.new(1, Enum.EasingStyle.Quart)
local goal = {
Position = UDim2.new(0, -850, 0, 75)
}
local goalEffect = {
Size = UDim2.new(0, 327, 0, 117),
Position = UDim2.new(0, 0, 0, 0)
}
local goal2 = {
Position = UDim2.new(0, 50, 0, 75)
}
local playTween = TweenService:Create(mainMenuFrame, TweenInformation, goal)
mainMenuFrame.QuickPlay.Activated:Connect(function()
playTween:Play()
local effect = Instance.new("TextLabel", mainMenuFrame.QuickPlay)
local round = Instance.new("UICorner", mainMenuFrame.QuickPlay.effect)
round.CornerRadius = 0.99
effect.Size = UDim2.new(0, 10, 0, 10)
effect.Position = UDim2.new(158, 0, 53, 0)
effect.Text = ""
effect.BackgroundTransparency = 0.45
local playEffect = TweenService:Create(round, TweenInformation, goalEffect)
playEffect:Play()
end)
Description of the effect: It should look like something similar to this video, as you can see, there is a little white circle appearing when the UI is clicked.
Is it the tween or the event not working? Do print statements work inside the function?
I would have thought the tween would have caused an error attempting to change properties of an instance that didn’t have them. Also, the parenting argument of Instance.new() doesn’t always work as expected so it is better to manually set this after changing any other properties.
Try this: