ModuleScript not being defined

I found this ModuleScript that makes Bezier Curves with tweening. When I pasted the code to function this, The module script was not being defined. I tried using WaitForChild() but it gave me this warning instead:

Local Script:

--TweenService
local TweenService = game:GetService("TweenService")
local ServerScriptService = game:GetService("ServerScriptService")

--Cameras
local Camera = workspace.CurrentCamera
local ShopCam = workspace.ShopCam
local CamPart = workspace.CamPart

--Frames
local ShopFrame = script.Parent.Parent.ShopFrame

--Buttons
local SettingsButton = script.Parent.Parent.OpenSettings
local OpenCredits = script.Parent.Parent.OpenCredits
local PlayButton = script.Parent.Parent.Play
local OpenShop = script.Parent

local isButtonActive = true

local BezierTween = require(ServerScriptService:WaitForChild("BezierTweens"))
local Waypoints = BezierTween.Waypoints
local P0, P1, P2, P3 = workspace.WaypointsShop.P0, workspace.WaypointsShop.P1, workspace.WaypointsShop.P2, workspace.WaypointsShop.P3

waypoints = Waypoints.new(P0, P1, P2, P3)
local Part = game.Workspace.Part

local Tween = BezierTween.Create(Part, {
	Waypoints = waypoints,
	EasingStyle = Enum.EasingStyle.Sine,
	EasingDirection = Enum.EasingDirection.In,
	Time = 5,
})

OpenShop.MouseButton1Click:Connect(function()
	if not isButtonActive then
		return
	end
	
	isButtonActive = false -- Disable the button

	PlayButton:TweenPosition(UDim2.new(0.5, 0, 1.072, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, false)
	OpenCredits:TweenPosition(UDim2.new(0.413, 0, 1.04, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, false)
	SettingsButton:TweenPosition(UDim2.new(0.5, 0, 1.04, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, false)
	OpenShop:TweenPosition(UDim2.new(0.586, 0, 1.04, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, false)
	Camera.CameraType = Enum.CameraType.Scriptable
	local tween = TweenService:Create(Camera, TweenInfo.new(2.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0), {CFrame = ShopCam.CFrame})
	tween:Play()
	Tween:Play()
	wait(5)
	ShopFrame.Visible = true
	
	isButtonActive = true
end)

Where the warning happens:

Correct me if I’m wrong, but I’m pretty sure no script can access the descendants of ServerScriptService.

You would want to put the module into ReplicatedStorage Instead, so it can be access by both regular and local scripts.

1 Like

no localscript specifically, but yes ServerScriptService and ServerStorage arent replicated to the client

You can see this in the explorer when you’re running in studio

1 Like

Oh okay, it worked nicely, thanks!

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