You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I’m attempting to contact a module script from a server script, however it does not work.
- What is the issue? Include screenshots / videos if possible!
When I call the module function in a script nothing in the module prints, the script is calling it and printing, however it never seems to actually reach the module script.
I’ve tried looking at the following but none helped.
Here’s the function that calls the module:
local function AlertWantedLogic(Assailant,Victim)
warn("module being contacted")
local PCS = game.ServerScriptService.WantedLevelLogistics.PlayerCriminalSystem
print(PCS)
PCS.ShotCheck(Assailant,Victim)
end
The warn prints
This is the module iself:
local PCS = {}
-- function checks who was shot, if it's an innocent person or a cop then they get a wanted level
function PCS.ShotCheck(Assailant,Victim)
warn("Something Bruh")
--teams
local police = game.Teams.Police
local Civ = game.Teams.Civillian
print(Assailant)
print(Victim)
local Ateam = Assailant.Team
local Vteam = Victim.Team
print(Ateam)
print(Vteam)
if Ateam == Civ and Vteam == police then
-- make the assailant wanted for firing on an officer
-- Add 5 minutws to thier wanted time, and give them level 2 for assault on a peace officer
local WantedBool = Assailant:FindFirstChild("IsWantedBoolean")
WantedBool.Value = true
WantedBool:SetAttribute("WantedTimeRemaining",WantedBool:GetAttribute("WantedTimeRemaining") + 300)
WantedBool:SetAttribute("WantedLevel",WantedBool:GetAttribute("WantedLevel") + 2)
elseif Ateam == Civ and Vteam == Civ then
-- check if the second civ is hositle, if they are let the shooting be valid and give a **LOWER** wanted level for self defence
-- if the second civ is not hostile give the max wamnted level for shooting an innocent civ.
elseif Ateam == police and Vteam == Civ then
-- if a cop shoots a civilian AND the civ is hostile then allow it -- maybe hosite or armed with a gun
-- if a cop shoots a non-hostile civ then fire them and imprison them for a few after lets say 2 warnings
end
return
end
return PCS
I tried it without the return in the function, and with and neither worked.
If anyone knows why this is I’d appreciate it!