Hello, Ive made a simple click effect, but for some reasons, the actual click effect is appearing above the actual clicks. This is what i mean:
This is my script:
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local StarterGui = script.Parent
local TweenService = game:GetService("TweenService")
local TweenInformation = TweenInfo.new(.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0)
local Goals = {ImageTransparency = 1, Size = UDim2.new(0.047, 0,0.098, 0)}
Mouse.Button1Down:Connect(function()
local PositionX = Mouse.X
local PositionY = Mouse.Y
local NewCircle = script:WaitForChild("Click"):Clone()
NewCircle.Parent = StarterGui:WaitForChild("MainUI")
NewCircle.Position = UDim2.new(0,PositionX,0,PositionY)
TweenService:Create(NewCircle,TweenInformation,Goals):Play()
task.wait(.5)
NewCircle:Destroy()
end)
1 Like
Geolio9
(Tomate)
June 16, 2024, 7:57pm
#2
What does the UI look like? show a picture of it with the properties.
1 Like
Make sure that
NewCircle.AnchorPoint = Vector2.new(0.5, 0.5)
You can do this in studio or in script
all this does is makes the center of the NewCircle the middle of it instead of the top left corner
1 Like
Geolio9
(Tomate)
June 16, 2024, 8:06pm
#4
I was gonna say this, but I’m pretty sure he has the size at 0, so that when he tweens the size it will be centered.
1 Like
I tried his script in studio and my fix seemed to work quite fine
2 Likes
Geolio9
(Tomate)
June 16, 2024, 8:16pm
#6
I think it’s an issue with UI. It should work exactly the same without it.
1 Like
Geolio9
(Tomate)
June 16, 2024, 8:20pm
#7
Actually, nevermind. I think both of them are issues. It won’t work without anchor point.
1 Like
Lightlimn
(Lightlimn)
June 16, 2024, 8:47pm
#8
You’ll want to take into account the UI inset because of the topbar. It should be 36 pixels (on the Y axis) unless it’s changed. That’ll be the issue though.
1 Like
7z99
(cody)
June 16, 2024, 9:23pm
#9
This is the solution, just wanted to add that you should get the GUI inset using guiService:GetGuiInset().Y
which will work for the old and new topbar
2 Likes
Replace this with
local PositionY = Mouse.Y + (game.GuiService:GetGuiInset()).Y
1 Like