You can write your topic however you want, but you need to answer these questions
- I’m making an easy way to emit particles using one large parent module, however, when I come to test the script to see if it emits the particle, it only shows in the game’s server and not client. (This is weird because from my previous game I ctrlC + ctrlV’d it from it works, but it doesn’t in this game???!?!?)
-I tried certain solutions such as making a script parented to the particle emitter’s parent part but it doesn’t work, I don’t know if the problem is concerning my bad script or is just an issue with the particle emitter itself
-(The scripts I used were all non-local scripts and the module is also non-local as it is required by a non-local script)
-(The part for the particle appears but it doesn’t “emitt” anything(I’m using the :Emitt() function to emitt the particles))
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
You can ignore most of the stuff… the import functions are: CreateParticle(), Weld2Parts(), and module:Damage()
local DS = game:GetService("Debris")
local TFD = {}
local function AddDebounce(Enemy:Model)
table.insert(TFD,{Enemy})
end
local function CycleDebounces(Enemy:Model)
local bool = false
for _,v in pairs(TFD) do
if v[1] == Enemy then
bool = true
end
end
return bool
end
local function RemoveDebouce(Enemy:Model)
for num,v in pairs(TFD) do
if v[1] == Enemy then
table.remove(TFD,num)
end
end
end
local function CheckAndReturn(Table,String:string)
for _,v in Table do
if v.N == String then
return v.V
end
end
end
local function Weld2Parts(p1,p2)
local W = Instance.new("WeldConstraint")
W.Part0 = p1
W.Part1 = p2
W.Parent = p1
end
local function CreateParticle(Particle:Part,PosPart,Time:number,mina:number,maxa:number,Clr)
local clone = Particle:Clone()
clone.Parent = game.Workspace.Debree
clone.CFrame = PosPart.CFrame
DS:AddItem(clone,Time)
for _,v in clone:GetDescendants() do
if v:IsA("ParticleEmitter") then
v.Color = ColorSequence.new(Color3.new(Clr))
if v.Name == "Small" then
v:Emit(math.random(mina/2,maxa/2))
else
v:Emit(math.random(mina,maxa))
end
end
end
end
local module = {}
module.__index = module
function module.CreateHitBox(Tool:Part,Length:number,minD,MaxD)
local self = setmetatable({},module)
local P = Instance.new("Part")
P.Size = Tool.Size * 1.1
P.CFrame = Tool.CFrame
P.Anchored = false
P.Transparency = 1
P.Parent = Tool:WaitForChild("Debree")
P.CanCollide = false
Weld2Parts(P,Tool)
DS:AddItem(P,Length)
self._L = Length
self._Attributes = {}
self._Part = P
self._Dmgs = {
md = minD,
MD = MaxD
}
return self
end
function module:Damage(T,H:Humanoid,PosP:Part,CD)
local Dmg = self._Dmgs
if CheckAndReturn(T,"IsInvincible") == false and not CycleDebounces(H.Parent) then
local Def = CheckAndReturn(T,"Def")
local DmgC = (math.random(Dmg.md,Dmg.MD) - Def)
local BloodClr = CheckAndReturn(T,"Clr")
if DmgC <= 0 then
DmgC = 0
end
AddDebounce(H.Parent)
CreateParticle(game.ServerStorage.VFX.CombatOnly.Sword.Hit,PosP,1.5,22,40,BloodClr)
H:TakeDamage(DmgC)
wait(CD)
RemoveDebouce(H.Parent)
end
end
return module
I forgot to add the main script
local PlrS = game:GetService("Players")
local DS = game:GetService("Debris")
local minD = script.Parent.mindmg.Value
local maxD = script.Parent.maxdmg.Value
local MaxCombo = 2
local GD = false
local ParticleType = "Sword"
local CM = require(game.ServerScriptService.Modules.SwordCombat.Main)
local DS = game:GetService("Debris")
local Tool = script.Parent
local H = Tool.Handle
local Plr
local Char
local ToolEquipped
local Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
}
Tool.Grip = Grips.Up
Tool.Equipped:Connect(function()
Char = Tool.Parent
Plr = PlrS:GetPlayerFromCharacter(Char)
Char:SetAttribute("TS",true)
Char:SetAttribute("Combo",1)
end)
Tool.Unequipped:Connect(function()
Plr = Tool.Parent.Parent
Char = Plr.Character
Char:SetAttribute("TS",false)
end)
Tool.Activated:Connect(function()
--[[local IsBlocking = Char:GetAttribute("IsBlocking")
local Stunned = Char:GetAttribute("Stunned")
local Dodging = Char:GetAttribute("IsRolling")
if IsBlocking == true or Stunned == true or Dodging == true then return end]]
Char:SetAttribute("Attacking",true)
if GD == true then return end
GD = true
local Combo = Char:GetAttribute("Combo")
if Combo < MaxCombo then
Char:SetAttribute("Combo",Combo +1)
else
Char:SetAttribute("Combo",1)
end
local Animator = Char.Humanoid.Animator
local Animation = Tool.Folder:FindFirstChild("Slash"..Combo)
local A = Animator:LoadAnimation(Animation)
A:Play()
wait(0.05)
wait(A.Length * 0.2)
Tool.Grip = Grips.Out
local HitBox = CM.CreateHitBox(script.Parent.Handle,A.Length * 0.8,script.Parent.mindmg.Value,script.Parent.maxdmg.Value)
local Att = {}
HitBox._Part.Touched:Connect(function(H)
if H.Parent:FindFirstChild("Zombie") ~= nil then
for Name,value in H.Parent:GetAttributes() do
table.insert(Att,{N = Name,V = value})
end
for _,v in H.Parent.Config:GetChildren() do
table.insert(Att,{N = v.Name,V = v.Value})
end
HitBox:Damage(Att,H.Parent:FindFirstChild("Zombie"),H,0.6)
table.clear(Att)
end
end)
wait(HitBox._L * 1.2)
GD = false
Tool.Grip = Grips.Up
end)