ZoneModule Script Help?

Hello,
I am currently trying to make a zone using a module named ZonePlus.
I’m trying to achieve a server response whenever a player enters and leaves the zone.

This is my current code:

-- VARS 
local ZoneModule = game.ReplicatedStorage:WaitForChild("Modules"):WaitForChild("Zone")
local ZoneConnect = ZoneModule.new(workspace.SafeZone)

-- FUNCTIONS

ZoneConnect.playerEntered:Connect(function(player: Player)
	print(player.Name.." Has entered the zone")
end)

ZoneConnect.playerExited:Connect(function(player: Player)
	print(player.Name.." Has left the zone")
end)

And the error it returns when I load the game is:
new is not a valid member of ModuleScript "ReplicatedStorage.Modules.Zone" - Server - SafeZoneTest:3

Even though in the module script it is there on line 34?
Any help would be much appreciated!

You need to require the module

local ZoneModule = require(game.ReplicatedStorage:WaitForChild("Modules"):WaitForChild("Zone"))

2 Likes

I would like to thank you for the help, personally I literally have no clue how I missed that lol? thanks man

1 Like

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