Hello There!, Im currently making a ui animation moudle. However, i keep getting this error in the local script that runs the tween when clicked: Players.ScxiptedShark.PlayerGui.ScreenGui.TextButton.LocalScript:3: attempt to call a nil value
Heres the local script:
local module = require(game.ReplicatedStorage:WaitForChild(“UiAnimations”))
script.Parent.MouseButton1Click:Connect(function()
module.Shrink(script.Parent, .5, .2)
end)
And here’s the module script:
local moudle = {}
local TweenService = game:GetService(“TweenService”)
local SizeCoolDown = false
local function Shrink(element, Factor, speed)
local SizeX = element.Size.X.ScaleFactor
local SizeY = element.Size.Y.ScaleFactor
local ShrinkInfo = TweenInfo.new(
speed,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
0,
true,
0
)
local ShrinkTween = TweenService:Create(element, ShrinkInfo, {Size = UDim2.new(SizeX,0,SizeY,0)})
ShrinkTween:Play()
Wait wait I see the issue now, it’s that plus you only wrote function Shrink, it’s supposed to be moudle.Shrink, writing it how you wrote it made the modulescript think it’s a function only for it, not for use in other scripts