Bug with TweenService effect

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.

note: the video above is not my game

Were there any errors or warnings in your console?
And by the way, don’t forgot to put some print() statements to be able to detect silent errors.

No errors apparently, I will try to put some print statements.

I’m not sure this Tween would work on the Uicorner (round) I think you meant to apply it to the text label (effect)?

1 Like

Thanks! I changed it to effect. But it still doesn’t work :confused:

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:

mainMenuFrame.QuickPlay.Activated:Connect(function()
    print("quickplay activated")
    playTween:Play()
    local effect = Instance.new("TextLabel")
    local round = Instance.new("UICorner")
    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
    effect.Parent = mainMenuFrame.QuickPlay
    round.Parent = effect
    print(effect, "has been parented to", effect.Parent)
    local playEffect = TweenService:Create(effect, TweenInformation, goalEffect)
    playEffect:Play()
end)
1 Like

Thanks!
Alright, so here is what I had from the output:
image

I believe this happens because I put 0.99 and not 0,99
Format of the CornerRadius: image
However…
image
“Assigning 2 values to 1 variable leaves some values unused.”
What should I do about this?

Nevermind, I just figured out I had to use

UDim.new(0,99)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.