ModuleScript: attempt to call a nil value (GuiObject)

Please help, my ModuleScript function dosen’t work

DISCLAIMER: I am very new to scripting with ModuleScripts. I’m trying to make scripts that you can actually understand.

The output logs spit out this:

ReplicatedStorage.TweenManager:7: attempt to call a nil value  

The ModuleScript is:

local module = {}
-- I'm not bothered to put my own comments.
function module.TweenBetweenPages(startpage, endingpage)
startpage:TweenPosition(
	UDim2.new(-1,0,0,0),           -- Final position the tween should reach
	Enum.EasingDirection.In, -- Direction of the easing
	Enum.EasingStyle.Sine,   -- Kind of easing to apply
	2,                       -- Duration of the tween in seconds
	true,                    -- Whether in-progress tweens are interrupted
	nil                 -- Function to be callled when on completion/cancelation
)

endingpage:TweenPosition(
	UDim2.new(0,0,0,0),           -- Final position the tween should reach
	Enum.EasingDirection.In, -- Direction of the easing
	Enum.EasingStyle.Sine,   -- Kind of easing to apply
	2,                       -- Duration of the tween in seconds
	true,                    -- Whether in-progress tweens are interrupted
	nil                 -- Function to be callled when on completion/cancelation
)

end

return module

and the LocalScript is:

-- I'm now going to fix this crappy script when the ModuleScript actually works
local gui = script.Parent.Parent.Parent
local tm = require(game.ReplicatedStorage:WaitForChild("TweenManager"))  
local main = script.Parent
local ending = gui.CheckIn
script.Parent.MouseButton1Down:Connect(function()
	tm:TweenBetweenPages(main, ending)
end)

This is my first post on the DevForum.

Best regards, IAmALazyDev

now im going to dance until there is a reply

whip_nae_nae_cursed_roblox

In the local script, “:TweenBetweenPages” should be called with . not :

1 Like

Works, Thank you for the quick reply!

1 Like