When the player enter a safe zone, it sets the isSafe value to true by requiring the module of the player which touched the zone. But when I do this, it throws an error saying “Requested module experienced an error while loading”. Here’s my safe zone code
for i, v in ipairs(script.Parent:GetChildren()) do
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local util = require(plr:WaitForChild("Util"))
util.Status[2] = true
print(util.Status[2])
end
end
end)
v.TouchEnded:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local util = require(plr:WaitForChild("Util"))
util.Status[2] = false
print(util.Status[2])
end
end
end)
end
Are you sure that the Util module exists inside the player instance NOT the character / somewhere else inside the player not the actual instance like a descendant ?
You said the error was “Requested module experienced an error while loading” this means that there was something wrong with the module itself not loading it, are you sure the module itself has no errors? Try requiring it from the command bar and see if it did the same error (without starting the game) if yes than the error is the module itself.
This means that something changes the content of the module script before you require it, try using the command bar and calling each function inside the module to make sure it doesn’t error.