local MouseClickEffect = {}
local function Tween(OBJInstance,Goal,Duration)
local ts = game:GetService("TweenService")
local T = ts:Create(OBJInstance,TweenInfo.new(Duration),Goal)
T:Play()
end
local function Offset(Offset)
return UDim2.fromOffset(Offset.X, Offset.Y)
end
function MouseClickEffect.AddEffect(GUIInstance,Mouse,Duration,Plr)
GUIInstance.ClipsDescendants = false
GUIInstance.AutoButtonColor = false
local MX,MY = Mouse.X,Mouse.Y
local ASX,ASY = GUIInstance.AbsoluteSize.X,GUIInstance.AbsoluteSize.Y
local effect = script.Effect:Clone()
effect.Parent = Plr.PlayerGui
local Pos = GUIInstance.AbsolutePosition
effect.Effect.Position = UDim2.fromOffset(Pos.X,Pos.Y)
effect.Effect.Size = UDim2.fromOffset(ASX,ASY)
effect.Effect.Ripple.Position = Offset(Vector2.new(MX,MY))
local maxsize = math.max(ASX,ASY)*2
effect.Effect.Ripple:TweenSize(UDim2.fromOffset(maxsize,maxsize),"Out","Sine",Duration)
Tween(effect.Effect.Ripple,{BackgroundTransparency = 1},Duration)
wait(Duration)
effect:Destroy()
end
return MouseClickEffect
So the script above position the GUI at a awkward angle and i dont want that and i dont know why it does that for no reason at all so can you please help me
I think it’s because you’re changing the position of this “Ripple” (which is a Gui object I suppose) relative to its Parent. If you want the actual mouse position, the frame should be directly inside a ScreenGui or inside a screen size frame