Uh, what’s the error you’re getting?
It does not show any errors in the output.
It’s an error with the Module itself it seems, could you send it how it is right now and if you can, format it
_Module = {}
function CreateTag(plr,enemy)
if enemy ~= nil then
if (enemy:FindFirstChild(“Player_Tag”)) then return end
local tag = Instance.new(“ObjectValue”, enemy)
tag.Name = “Player_Tag”
tag.Value = plr
end
end
function DestroyTag(enemy)
if enemy ~= nil then
local tag = enemy:FindFirstChild(“Player_Tag”)
if tag ~= nil then tag:Destroy() end
end
end
local function CheckDistance(plr,tor,dist)
if (not tor) or (not tor.Parent) or (not tor.Parent:FindFirstChild(“MobConfig”)) then return end
if plr:DistanceFromCharacter(Vector3.new(tor.Position.X,tor.Position.Y,tor.Position.Z)) < require(tor.Parent.MobConfig).FollowDistance then
return true else return false
end
end
function addComas(str)
return #str % 3 == 0 and str:reverse():gsub(“(%d%d%d)”, “%1,”):reverse():sub(2) or str:reverse():gsub(“(%d%d%d)”, “%1,”):reverse()
end
local function CreateObject(hit,dmg)
local ObjModel = Instance.new(“Model”, workspace.DebrisHolder)
local Obj = Instance.new(“Part”, ObjModel)
– Appearance
Obj.BrickColor = BrickColor.new(“Bright red”)
Obj.Material = Enum.Material.Neon
Obj.Transparency = 1
– Data
Obj.Position = hit.Parent:FindFirstChild(“Head”).Position + Vector3.new(math.random(-1.6,1.6),2,math.random(-1.6,1.6))
– Behavior
Obj.Anchored = true
Obj.CanCollide = false
Obj.Locked = true
– Part
Obj.Shape = Enum.PartType.Ball
Obj.Size = Vector3.new(0.75,0.75,0.75)
– Billboard Gui
local Gui = script.BillboardGui:Clone()
Gui.Adornee = ObjModel:FindFirstChild(“Part”)
Gui.TextLabel.Text = addComas(tostring(dmg))…" damage"
Gui.Parent = ObjModel
local ObjPos = Instance.new("BodyPosition", Obj)
ObjPos.Position = Vector3.new(0,7.85,0)
for i = 1,0,-0.1 do
Obj.Transparency = i
Gui.TextLabel.TextTransparency = i
Gui.TextLabel.TextStrokeTransparency = i
wait()
end
wait(0.50)
for i = 0,1,0.1 do
Obj.Transparency = i
Gui.TextLabel.TextTransparency = i
Gui.TextLabel.TextStrokeTransparency = i
wait()
end
return ObjModel
end
function _Module.Damage(plr,hit,enemy)
local chr = plr.Character or plr.CharacterAdded:Wait()
local tool = chr:FindFirstChildOfClass(“Tool”)
if (not enemy) or (not hit) or (not tool) then return end
local tor = hit.Parent:FindFirstChild(“Torso”)
if (not hit.Parent) or (not tor) then return end
if (game.Players:GetPlayerFromCharacter(enemy.Parent)) then return end
if (not CheckDistance(plr,hit.Parent:FindFirstChild(“Torso”))) then return end
local config = require(tool.WeaponConfig)
local dmg = math.random(config.MinDamage,config.MaxDamage)
if (plr:FindFirstChild(“leaderstats”)) then
if plr:FindFirstChild(“Level”) then
dmg = dmg + (plr.leaderstats.Level.Value - 1)
end
end
CreateTag(plr,enemy)
enemy:TakeDamage(dmg)
local ObjModel = CreateObject(hit,dmg)
ObjModel:Destroy()
DestroyTag(ObjModel)
end
Where’s the return _Module
that’s supposed to be at the end?
After the function for Damaging, there should be a return _Module
, did you accidentally delete it?
maybe
That’s why the module is erroring, you need to return the module, reinsert it as the last line of code in the module
How can I reinsert the module just do controle z?
Just add thsi line
return _Module
at the very end of the ModuleScript, after the end
of function _Module.Damage
Any errors? Also again, I think you’re using an older version of what I said, change the entire _Module.Damage function with this
function _Module.Damage(plr,hit,enemy)
local chr = plr.Character or plr.CharacterAdded:Wait()
local tool = chr:FindFirstChildOfClass("Tool")
if (not enemy) or (not hit) or (not tool) then return end
local tor = hit.Parent:FindFirstChild("Torso")
if (not hit.Parent) or (not tor) then return end
if (game.Players:GetPlayerFromCharacter(enemy.Parent)) then return end
if (not CheckDistance(plr,hit.Parent:FindFirstChild("Torso"))) then return end
local config = require(tool.WeaponConfig)
local dmg = math.random(config.MinDamage,config.MaxDamage)
if (plr:FindFirstChild("leaderstats")) then
if plr:FindFirstChild("Level") then
dmg = dmg + (plr.leaderstats.Level.Value - 1)
end
end
CreateTag(plr,enemy)
enemy:TakeDamage(dmg)
local ObjModel = CreateObject(hit,dmg)
ObjModel:Destroy()
DestroyTag(ObjModel)
end
Sorry my fault but its still not working
Scroll up a bit till it mentions the error the module is having
Okay I need the full code again to look through, the return was probably done incorrettly
_Module = {}
function CreateTag(plr,enemy)
if enemy ~= nil then
if (enemy:FindFirstChild(“Player_Tag”)) then return end
local tag = Instance.new(“ObjectValue”, enemy)
tag.Name = “Player_Tag”
tag.Value = plr
end
end
function DestroyTag(enemy)
if enemy ~= nil then
local tag = enemy:FindFirstChild(“Player_Tag”)
if tag ~= nil then tag:Destroy() end
end
end
local function CheckDistance(plr,tor,dist)
if (not tor) or (not tor.Parent) or (not tor.Parent:FindFirstChild(“MobConfig”)) then return end
if plr:DistanceFromCharacter(Vector3.new(tor.Position.X,tor.Position.Y,tor.Position.Z)) < require(tor.Parent.MobConfig).FollowDistance then
return true else return false
end
end
function addComas(str)
return #str % 3 == 0 and str:reverse():gsub(“(%d%d%d)”, “%1,”):reverse():sub(2) or str:reverse():gsub(“(%d%d%d)”, “%1,”):reverse()
end
local function CreateObject(hit,dmg)
local ObjModel = Instance.new(“Model”, workspace.DebrisHolder)
local Obj = Instance.new(“Part”, ObjModel)
– Appearance
Obj.BrickColor = BrickColor.new(“Bright red”)
Obj.Material = Enum.Material.Neon
Obj.Transparency = 1
– Data
Obj.Position = hit.Parent:FindFirstChild(“Head”).Position + Vector3.new(math.random(-1.6,1.6),2,math.random(-1.6,1.6))
– Behavior
Obj.Anchored = true
Obj.CanCollide = false
Obj.Locked = true
– Part
Obj.Shape = Enum.PartType.Ball
Obj.Size = Vector3.new(0.75,0.75,0.75)
– Billboard Gui
local Gui = script.BillboardGui:Clone()
Gui.Adornee = ObjModel:FindFirstChild(“Part”)
Gui.TextLabel.Text = addComas(tostring(dmg))…" damage"
Gui.Parent = ObjModel
local ObjPos = Instance.new("BodyPosition", Obj)
ObjPos.Position = Vector3.new(0,7.85,0)
for i = 1,0,-0.1 do
Obj.Transparency = i
Gui.TextLabel.TextTransparency = i
Gui.TextLabel.TextStrokeTransparency = i
wait()
end
wait(0.50)
for i = 0,1,0.1 do
Obj.Transparency = i
Gui.TextLabel.TextTransparency = i
Gui.TextLabel.TextStrokeTransparency = i
wait()
end
return ObjModel
end
function _Module.Damage(plr,hit,enemy)
local chr = plr.Character or plr.CharacterAdded:Wait()
local tool = chr:FindFirstChildOfClass(“Tool”)
if (not enemy) or (not hit) or (not tool) then return end
local tor = hit.Parent:FindFirstChild(“Torso”)
if (not hit.Parent) or (not tor) then return end
if (game.Players:GetPlayerFromCharacter(enemy.Parent)) then return end
if (not CheckDistance(plr,hit.Parent:FindFirstChild(“Torso”))) then return end
local config = require(tool.WeaponConfig)
local dmg = math.random(config.MinDamage,config.MaxDamage)
if (plr:FindFirstChild(“leaderstats”)) then
if plr:FindFirstChild(“Level”) then
dmg = dmg + (plr.leaderstats.Level.Value - 1)
end
end
CreateTag(plr,enemy)
enemy:TakeDamage(dmg)
local ObjModel = CreateObject(hit,dmg)
ObjModel:Destroy()
DestroyTag(ObjModel)
end
Okay where’s the return _Module
in this one?