A module script activates 4 times

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

i want to know why my sctript is activating 4 times

  1. What is the issue? Include screenshots / videos if possible!

my script activates 4 times

my module script:

local K = {}

function K:Initiliazite(Type, Parent)
	if Type == "Server" then
		warn("Pro's Admin is loaded!")
		if Parent  then
			   Parent:Clone().Parent = game.Workspace
		       Parent:Destroy()
			   wait(0.01)
			   require(game.Workspace["Admin"].AdminLoaderAndSettings.AdminModule.Admin.Scripts.Main)	
			   require(game.Workspace["Admin"].AdminLoaderAndSettings.AdminModule.Admin.LocalData.BannedData)
		end	
	end
end

return K

Normal Script:

Loader = require(script.Parent.ClientAndServerLoaded)
Loader:Initiliazite("Server", game.Workspace.Admin)

why it activates 4 times?

I mean can’t you use a breakpoint to check it out why it repeats 4 times?

what breakpoint means? it means break?

Here is a thread on how to use it.

oh so breakpoint means that red circle? but if next to that line is else? it will work or will stop at the brackpoint line?

It stops the script where you locate the breakpoint then you will also have an action ‘Step Into’ which is going to locate you into next line of script or move you in a script you are calling. I hope this helps. :herb:

1 Like

how to activate ‘Step Intro?’ 30characters

1 Like

Everything is written on a thread I have sent you before. Here is a snip of the thread. Basically you should have it in the menu above the script frame.

1 Like

thanks, this saved me 30characters

1 Like

Cool tip: You can check the current side the function is running in via the Script, so in your K:Initiliazite function it’s possible to use RunService:IsServer / RunService:IsClient to determine the side instead of having to rely on a string parameter.

Here’s an example:

local RunService = game:GetService("RunService")

local function CheckSide()
    if RunService:IsServer() then
        --// Server side
    elseif RunService:IsClient() then
        --// Client side
    else
         --// Studio (Command line/Plugins)
    end
end

yeah, but the script is in workspace and the client part is to copy the guis and more so the script will always be in the workspace