You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to emit particles from a newly cloned object in server sided.
-
What is the issue? The particle does not emit upon using :Emit().
-
What solutions have you tried so far? Ive looked all over the hub, but i didnt see any similar problems. I tried waiting for one frame before emitting, but it does not work. For some reason, before i make this server sided, it was client sided. The particles emit just fine. Ive also checked the output, still nothing was wrong.
heres how it currently looks and how its supposed to look:
in this video, its consistent, but i want it to only emit once.
Heres the entirety of the script that clones the object and emits the particle, please dont mind if its messy, i barely have time to work on it and i will clean it up in the future:
game.ReplicatedStorage.Atk.OnServerEvent:Connect(function(plr,Atk,Folder,Mouse,hitP)
if Atk == "LightBeam" then
local dist = 1034
local function CFramePointRightSide(pos, targetPos)
local directionToFace = (targetPos - pos).unit
local worldUp = Vector3.new(0,1,0)
local zAxisFace = directionToFace:Cross(worldUp)
local yAxisFace = directionToFace:Cross(zAxisFace)
return CFrame.fromMatrix(pos, directionToFace, yAxisFace, -zAxisFace)
end
local object = workspace.Beams.Beam:Clone()
object.Parent = workspace.Beams
object.CFrame = CFrame.new(plr.Character.PrimaryPart.Position,hitP)
local a = object.CFrame.LookVector
object.CFrame = CFramePointRightSide(plr.Character.PrimaryPart.Position,hitP)
object.CFrame = object.CFrame + a * dist
local snd = Folder.shoot:Clone()
snd.Parent = plr.Character
snd:Destroy()
task.wait()
object.Explosion.ParticleEmitter:Emit(5)
object.Explosion.Small:Emit(500)
for i,v in object.Explosion2:GetChildren() do
v:Emit(1)
end
for i,v in pairs(object:GetChildren()) do
if v:IsA("SurfaceLight") then
game.TweenService:Create(v, TweenInfo.new(4), {Brightness = 0, Range = 0}):Play()
end
end
object.Transparency = -3
game.TweenService:Create(object, TweenInfo.new(4), {Transparency = 1,Size = Vector3.new(2048,1,1)}):Play()
game.Debris:AddItem(object,4)
local sw1 = Folder.Shockwave:Clone()
sw1.Parent = workspace
sw1.CFrame = CFrame.new(plr.Character.PrimaryPart.Position,plr.Character.PrimaryPart.Position + object.CFrame.LookVector)
game.Debris:AddItem(sw1,0.033333)
local hrt = plr.Character.HumanoidRootPart
local hum = hrt.Parent.Humanoid
if hum.FloorMaterial ~= Enum.Material.Air then
local sw2 = Folder.Shockwave2:Clone()
sw2.Parent = workspace
sw2.Orientation = Vector3.new(-90,math.random(-360,360),0)
local Hpos = plr.Character.HumanoidRootPart.Position
sw2.Position = Vector3.new(Hpos.X, sw2.Position.Y, Hpos.Z)
game.TweenService:Create(sw2, TweenInfo.new(2,Enum.EasingStyle.Cubic), {Transparency = 1,Size = Vector3.new(100,100,10)}):Play()
game.Debris:AddItem(sw2,2)
end
local touchingPart
local istouching = false
object.Touched:Connect(function(otherPart: BasePart)
if otherPart.Parent then
if otherPart.Parent:FindFirstChild("Humanoid") then
touchingPart = otherPart
istouching = true
end
end
end)
object.TouchEnded:Connect(function(otherPart: BasePart)
if otherPart.Parent then
if otherPart.Parent:FindFirstChild("Humanoid") then
touchingPart = nil
istouching = false
end
end
end)
local function touched()
if touchingPart then
if touchingPart.Parent:FindFirstChild("Humanoid") and istouching then
if touchingPart.Parent.Name ~= plr.Character.Name then
touchingPart.Parent.Humanoid:TakeDamage(10)
local a = Instance.new("ForceField",touchingPart.Parent)
if touchingPart.Parent:FindFirstChild("ForceField") then
a:Destroy()
else
game.Debris:AddItem(a,4)
end
end
end
end
end
game["Run Service"].Heartbeat:Connect(touched)
end
end)```