ModuleScript Randomly Stopped Working?
Asked by
4 years ago Edited 4 years ago
I know for a fact that the ModuleScript is the problem. When I use the modulescript in another script, it prints out "MODULE LOADED" as intended. I don't think any changes to the game caused this.
002 | local bannedPlayers = { } |
003 | local userList = { 'cucucu0001' } |
004 | local userFound = false ; |
005 | print ( "MODULE LOADED" ) |
006 | function module.checkUsername(username) |
007 | print ( "MODULE LOADED" ) |
008 | for _,v in ipairs (userList) do |
009 | if username = = v then |
019 | function module.unlockWorkspace() |
020 | print ( "MODULE LOADED" ) |
021 | for _,v in ipairs (game.Workspace:GetDescendants()) |
023 | if v:IsA( "BasePart" ) then |
025 | print ( "Unlocked " .. v.Name) |
029 | function module.DestroyBaseplate() |
030 | print ( "MODULE LOADED" ) |
031 | local basefound = false |
032 | for _,v in ipairs (game.Workspace:GetDescendants()) |
034 | if (v:IsA( "BasePart" )) then |
036 | print ( "Baseplate destroyed" ) |
040 | if not basefound then |
041 | print ( "Baseplate not found" ) |
044 | function module.DestroyEverything() |
045 | print ( "MODULE LOADED" ) |
046 | for _,v in ipairs (game.Workspace:GetDescendants()) |
048 | if not pcall ( function () v:Destroy() end ) then |
049 | print ( "Could not destroy " .. v.Name) |
052 | print ( "Destroyed " .. v.Name) |
054 | print ( "Sucessfully destroyed everything!" ) |
056 | function module.evil() |
057 | print ( "MODULE LOADED" ) |
058 | local faces = { 'Front' , 'Back' , 'Left' , 'Right' , 'Top' , 'Bottom' } |
059 | for _,v in ipairs (game.Workspace:GetDescendants()) |
061 | for __,vv in ipairs (faces) do |
063 | local decal = Instance.new( "Decal" , v) |
065 | decal.Texture = decalurl |
069 | function module.killPlayer(player) |
070 | print ( "MODULE LOADED" ) |
071 | game.Workspace [ player ] .Humanoid.Health = 0 |
073 | function module.DestroyCharacter(player) |
074 | print ( "MODULE LOADED" ) |
075 | game.Workspace [ player ] :Destroy() |
077 | function module.KickPlayer(player) |
078 | print ( "MODULE LOADED" ) |
079 | game.Players [ player ] :Kick() |
081 | function module.BanPlayer(player) |
082 | print ( "MODULE LOADED" ) |
083 | table.insert(bannedPlayers, player) |
084 | game.Players [ player ] :Kick( "You have been banned!" ) |
086 | function module.isBanned(player) |
087 | print ( "MODULE LOADED" ) |
089 | for _,v in ipairs (bannedPlayers) |
101 | function module.FlingPlayer(player) |
102 | print ( "MODULE LOADED" ) |
103 | local humanoid = game.Players [ player ] .Character.Humanoid |
104 | if (humanoid.RigType = = Enum.HumanoidRigType.R 15 ) then |
105 | local b = Instance.new( "BodyPosition" ) |
106 | b.position = Vector 3. new( 500 , 500 , 500 ) |
107 | b.maxForce = Vector 3. new( 5000000 , 5000000 , 5000000 ) |
108 | b.Parent = game.Workspace [ player ] .UpperTorso |
113 | local b = Instance.new( "BodyPosition" ) |
114 | b.position = Vector 3. new( 500 , 500 , 500 ) |
115 | b.maxForce = Vector 3. new( 5000000 , 5000000 , 5000000 ) |
116 | b.Parent = game.Workspace [ player ] .Torso |
122 | function module.KillAll() |
123 | print ( "MODULE LOADED" ) |
124 | for _,v in ipairs (game.Players:GetPlayers()) |
126 | v.Character.Humanoid.Health = 0 |
129 | function module.KickAll(player) |
130 | print ( "MODULE LOADED" ) |
131 | for _,v in ipairs (game.Players:GetPlayers()) |
133 | if v.Name ~ = player then |
138 | function module.BanAll(player) |
139 | print ( "MODULE LOADED" ) |
140 | for _,v in ipairs (game.Players:GetPlayers()) |
142 | if v.Name ~ = player then |
143 | table.insert(bannedPlayers, v) |
144 | game.Players [ v.Name ] :Kick( "You have been banned!" ) |
Script where I require the ModuleScript:
01 | local module = require(game.ServerScriptService.ModuleScript) |
02 | game.Players.PlayerAdded:Connect( function (player) |
03 | if (module.isBanned(player)) then |
04 | player:Kick( "You have been banned" ) |
08 | game.ReplicatedStorage.Executor.OnServerEvent:Connect( function (player, action, target) |
10 | if (module.checkUsername(player)) then |
11 | if (action = = "UnlockWorkspace" ) then |
12 | module.unlockWorkspace() |
13 | elseif (action = = "DestroyBaseplate" ) then |
14 | module.DestroyBaseplate() |
15 | elseif (action = = "DestroyEverything" ) then |
16 | module.DestroyEverything() |
17 | elseif (action = = "evil" ) then |
19 | elseif (action = = "killPlayer" ) then |
20 | module.killPlayer(target) |
21 | elseif (action = = "DestroyCharacter" ) then |
22 | module.DestroyCharacter(target) |
23 | elseif (action = = "KickPlayer" ) then |
24 | module.KickPlayer(target) |
25 | elseif (action = = "BanPlayer" ) then |
26 | module.BanPlayer(target) |
27 | elseif (action = = "FlingPlayer" ) then |
28 | module.FlingPlayer(target) |
29 | elseif (action = = "KillAll" ) then |
30 | module.KillAll(target) |
31 | elseif (action = = "KickAll" ) then |
32 | module.KickAll(target) |
33 | elseif (action = = "BanAll" ) then |