You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
Hello i want to make module damage for server -
What is the issue?
if i damage with module and after hit with sword players heal goes back to 100 which means module never done damage and sometimes it shows like player dead but its not prob bcs of the same thing -
What solutions have you tried so far?
I tried to make it fired from a script not a local script but when i tried this it was giving errors about the module
tried to make another module for the damage but still the same
damage script i use in the module
local SquareHitBox = Instance.new("Part")
SquareHitBox.Size = Vector3.new(DamageRange.X, DamageRange.Y, DamageRange.Z)
SquareHitBox.Transparency = 1
SquareHitBox.CanCollide = false
SquareHitBox.Anchored = true
SquareHitBox.Name = "Hitbox"
SquareHitBox.Massless = true
SquareHitBox.Position = Mouse.p
game.Debris:AddItem(SquareHitBox,6)
SquareHitBox.Parent = game.Workspace.Effects
delay(4,function()
local alr_hit = {}
local function detect()
local ovParams = OverlapParams.new()
ovParams.CollisionGroup = "Default"
ovParams.FilterType = Enum.RaycastFilterType.Blacklist
ovParams.MaxParts = false
local parts = workspace:GetPartsInPart(SquareHitBox, ovParams)
for i,p in pairs(parts) do
local hit = p.Parent
local hum = hit:FindFirstChild("Humanoid")
if hum and not table.find(alr_hit, hum) and not (hum == Character.Humanoid) and hum:GetState() ~= Enum.HumanoidStateType.Dead then
for i,p in pairs(parts) do
local hit = p.Parent
local hum = hit:FindFirstChild("Humanoid")
table.insert(alr_hit, hum)
hit.Humanoid:TakeDamage(15)
end
end
end
end
coroutine.wrap(function()
while SquareHitBox.Parent == game.Workspace.Effects do
detect()
task.wait()
end
end)()
end)
the local script which im getting the module from
-- Player Variables --
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character
local Tool = script.Parent
-- Game Service --
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
-- Folders--
local SkillsFolder = ReplicatedStorage:WaitForChild("Skills")
local BackEndFolder = SkillsFolder:WaitForChild("BackEnd")
local SkillDataFolder = BackEndFolder:WaitForChild("SkillData")
local AbilitiesFolder = BackEndFolder:WaitForChild("Abilities")
-- Bool Values--
local ToolEquip = false
-- Key Bind Table --
KeyBinds = { -- Add Whatever Key you'd prefer
Z = nil,
X = nil,
C = nil,
V = nil,
B= nil
}
-- Ability Info --
local Ability = "String" -- Change to Whatever ability your trying to use
local SkillData = require(SkillDataFolder[Ability])
local AbilityModule = require(AbilitiesFolder[Ability])
for i, Info in pairs(SkillData) do -- This basically just sets different ability moves to each KeyBind again you can change it to your own keys
if Info.Key == "Z" then
KeyBinds.Z = Info.Name
elseif Info.Key == "X" then
KeyBinds.X = Info.Name
elseif Info.Key == "C" then
KeyBinds.C = Info.Name
elseif Info.Key == "V" then
KeyBinds.V = Info.Name
elseif Info.Key == "B" then
KeyBinds.B = Info.Name
end
end
-- User Input Service --
UserInputService.InputBegan:Connect(function(input, isGui)
if isGui then return end
if input.KeyCode == Enum.KeyCode.Z and KeyBinds.Z ~= nil and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Jumping and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and char.Humanoid:GetState() ~= Enum.HumanoidStateType.FallingDown and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead and char.CanDoAnything.Value == true then
print(KeyBinds.Z)
AbilityModule[KeyBinds.Z](plr)
elseif input.KeyCode == Enum.KeyCode.X and KeyBinds.X ~= nil and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Jumping and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and char.Humanoid:GetState() ~= Enum.HumanoidStateType.FallingDown and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead and char.CanDoAnything.Value == true then
print(KeyBinds.X)
AbilityModule[KeyBinds.X](plr)
elseif input.KeyCode == Enum.KeyCode.C and KeyBinds.C ~= nil and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead and char.CanDoAnything.Value == true then
print(KeyBinds.C)
AbilityModule[KeyBinds.C](plr)
elseif input.KeyCode == Enum.KeyCode.V and KeyBinds.V ~= nil and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Jumping and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and char.Humanoid:GetState() ~= Enum.HumanoidStateType.FallingDown and char.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead and char.CanDoAnything.Value == true then
print(KeyBinds.V)
AbilityModule[KeyBinds.V](plr)
elseif input.KeyCode == Enum.KeyCode.B and KeyBinds.B ~= nil then
print(KeyBinds.B)
AbilityModule[KeyBinds.B](plr)
end
end)