SFX and VFX being in only server/client

Hello. I was challenged to make an upgraded “Subspace Tripmine” with only scripts, no building in Studio, and that is why my script is kinda spaghetti and could be made alot easier. The first part where i Instance the ParticleEmitters into the game is because i can only use scripts. It works fine except that when i playtest it and play as my character (Current: Client) i cannot see the effects. But if i switch to server (Current: Server) you can see them just fine. Same thing with the sound but the opposite. I can only hear it on the Client not the Server. Why is this happening? Basically all of my code is on the Server and the Client only has the UserInputService keypress detection. The particles are cloned using :Clone. Dont insult my script too hard. Look for the comments to see where i emit and play the sound. They are far down.

ServerScript/Script:

local sequence = {
	NumberSequenceKeypoint.new(0, 10), 
	NumberSequenceKeypoint.new(0.698, 8), 
	NumberSequenceKeypoint.new(0.815, 5.56), 
	NumberSequenceKeypoint.new(1, 0)
}

local starpart = Instance.new("Part", workspace)
starpart.Size = Vector3.new(0.1, 0.1, 0.1)
starpart.Position = Vector3.new(0, -10, 0)
starpart.Anchored = true
starpart.Name = "testname"
local starpartparticle = Instance.new("ParticleEmitter", starpart)
starpartparticle.Color = ColorSequence.new(Color3.new(255, 255, 255))
starpartparticle.LightInfluence = 1000
starpartparticle.Size = NumberSequence.new(sequence)
starpartparticle.Texture = "rbxassetid://14834478801"
starpartparticle.ZOffset = 4
starpartparticle.Enabled = false
starpartparticle.Lifetime = NumberRange.new(5, 5)
starpartparticle.Speed = NumberRange.new(0, 0)

local aurapart1 = Instance.new("Part", workspace)
aurapart1.Size = Vector3.new(0.1, 0.1, 0.1)
aurapart1.Position = Vector3.new(0, -10, 0)
aurapart1.Anchored = true
local aurapart1particle = Instance.new("ParticleEmitter", aurapart1)
aurapart1particle.Color = ColorSequence.new(Color3.new(255, 0, 255))
aurapart1particle.LightEmission = 1
aurapart1particle.LightInfluence = 1000
aurapart1particle.Orientation = Enum.ParticleOrientation.VelocityPerpendicular
aurapart1particle.Size = NumberSequence.new(sequence)
aurapart1particle.Texture = "http://www.roblox.com/asset/?id=321556991"
aurapart1particle.Transparency = NumberSequence.new(0.7, 0.7)
aurapart1particle.ZOffset = -10
aurapart1particle.Enabled = false
aurapart1particle.Lifetime = NumberRange.new(5, 5)
aurapart1particle.Speed = NumberRange.new(0.001, 0.001)

local aurapart2 = Instance.new("Part", workspace)
aurapart2.Size = Vector3.new(0.1, 0.1, 0.1)
aurapart2.Position = Vector3.new(0, -10, 0)
aurapart2.Anchored = true
local aurapart2particle = Instance.new("ParticleEmitter", aurapart2)
aurapart2particle.Color = ColorSequence.new(Color3.new(0, 0, 0))
aurapart2particle.LightInfluence = 0
aurapart2particle.Orientation = Enum.ParticleOrientation.VelocityPerpendicular
aurapart2particle.Size = NumberSequence.new(sequence)
aurapart2particle.Texture = "http://www.roblox.com/asset/?id=321556991"
aurapart2particle.Transparency = NumberSequence.new(0.7, 0.7)
aurapart2particle.ZOffset = -9
aurapart2particle.Enabled = false
aurapart2particle.Lifetime = NumberRange.new(5, 5)
aurapart2particle.Speed = NumberRange.new(0.001, 0.001)

local explosion1 = Instance.new("Part", workspace)
explosion1.Size = Vector3.new(0.1, 0.1, 0.1)
explosion1.Position = Vector3.new(0, -10, 0)
explosion1.Anchored = true
local explosion1particle = Instance.new("ParticleEmitter", explosion1)
explosion1particle.Color = ColorSequence.new(Color3.new(1, 0, 1))
explosion1particle.LightInfluence = 1
explosion1particle.Size = NumberSequence.new(sequence)
explosion1particle.Texture = "http://www.roblox.com/asset/?id=275585682"
explosion1particle.ZOffset = 1
explosion1particle.Enabled = false
explosion1particle.Lifetime = NumberRange.new(5, 5)
explosion1particle.Rotation = NumberRange.new(-90, 90)
explosion1particle.RotSpeed = NumberRange.new(10, 40)
explosion1particle.Speed = NumberRange.new(0.001, 0.001)

local explosion2 = Instance.new("Part", workspace)
explosion2.Size = Vector3.new(0.1, 0.1, 0.1)
explosion2.Position = Vector3.new(0, -10, 0)
explosion2.Anchored = true
local explosion2particle = Instance.new("ParticleEmitter", explosion2)
explosion2particle.Color = ColorSequence.new(Color3.new(0.105882, 0, 0.105882))
explosion2particle.Size = NumberSequence.new(sequence)
explosion2particle.Texture = "http://www.roblox.com/asset/?id=275585682"
explosion2particle.ZOffset = -1
explosion2particle.Enabled = false
explosion2particle.Lifetime = NumberRange.new(5, 5)
explosion2particle.Rotation = NumberRange.new(-90, 90)
explosion2particle.RotSpeed = NumberRange.new(10, 40)
explosion2particle.Speed = NumberRange.new(0.001, 0.001)

local fog = Instance.new("Part", workspace)
fog.Size = Vector3.new(0.1, 0.1, 0.1)
fog.Position = Vector3.new(0, -10, 0)
fog.Anchored = true
local fogparticle = Instance.new("ParticleEmitter", fog)
fogparticle.Color = ColorSequence.new(Color3.new(0.192157, 0.145098, 0.196078))
fogparticle.Size = NumberSequence.new(10, 10)
fogparticle.Texture = "rbxassetid://528256032"
fogparticle.Transparency = NumberSequence.new(0.9, 0.9)
fogparticle.ZOffset = -3
fogparticle.Enabled = false
fogparticle.Lifetime = NumberRange.new(9.482, 9.482)
fogparticle.Speed = NumberRange.new(2, 2)
fogparticle.SpreadAngle = Vector2.new(360, 180)

local groundrock = Instance.new("Part", workspace)
groundrock.Size = Vector3.new(0.1, 0.1, 0.1)
groundrock.Position = Vector3.new(0, -10, 0)
groundrock.Anchored = true
local groundrockparticle = Instance.new("ParticleEmitter", groundrock)
groundrockparticle.Color = ColorSequence.new(Color3.new(1, 0, 1))
groundrockparticle.LightEmission = 100000
groundrockparticle.LightInfluence = 10000
groundrockparticle.Brightness = 1
groundrockparticle.Size = NumberSequence.new(1, 1)
groundrockparticle.Texture = "rbxassetid://7216979191"
groundrockparticle.Transparency = NumberSequence.new(0, 0)
groundrockparticle.ZOffset = -1
groundrockparticle.Enabled = false
groundrockparticle.Lifetime = NumberRange.new(0.1, 0.5)
groundrockparticle.Speed = NumberRange.new(1, 100)
groundrockparticle.SpreadAngle = Vector2.new(360, 180)


game.Workspace.otherremote.OnServerEvent:Connect(function(player)
	local tripmine = Instance.new("Part", workspace)
	local mesh = Instance.new("SpecialMesh", tripmine)
	local hrp = player.Character.HumanoidRootPart
	local look = hrp.CFrame.LookVector
	local plus = Vector3.new(0, 5, 0)
	tripmine.Size = Vector3.new(3.5, 3.5, 3.5)
	mesh.MeshId = "rbxassetid://18947440684"
	mesh.TextureId = "rbxassetid://11954766"
	tripmine.Position = hrp.Position + look * 3 + plus
	tripmine.AssemblyLinearVelocity = Vector3.new(look.X * 100, 0, look.Z * 100)
	task.wait(1)
	
	local smoke = fog:Clone()
	smoke.Parent = game.Workspace

	local aura1 = aurapart1:Clone()
	aura1.Parent = game.Workspace
	local aura2 = aurapart2:Clone()
	aura2.Parent = game.Workspace

	local star = starpart:Clone()
	star.Parent = game.Workspace
	
	local explo1 = explosion1:Clone()
	explo1.Parent = game.Workspace
	local explo2 = explosion2:Clone()
	explo2.Parent = game.Workspace

	local debris = groundrock:Clone()
	debris.Parent = game.Workspace
	
	local sound = Instance.new("Sound", star)
	sound.SoundId = "http://www.roblox.com/asset/?id=11984351"
	
	smoke.Position = tripmine.Position + plus
	aura1.Position = tripmine.Position + plus
	aura2.Position = tripmine.Position + plus
	star.Position = tripmine.Position + plus
	explo1.Position = tripmine.Position + plus
	explo2.Position = tripmine.Position + plus
	debris.Position = tripmine.Position + plus
	
--This is the part where it emits
	smoke.ParticleEmitter:Emit(3)
	aura1.ParticleEmitter:Emit(1)
	aura2.ParticleEmitter:Emit(1)
	star.ParticleEmitter:Emit(1)
	explo1.ParticleEmitter:Emit(1)
	explo2.ParticleEmitter:Emit(1)
	debris.ParticleEmitter:Emit(100)

--And this is where the sound plays
	sound:Play()
	
	local color1 = Instance.new("ColorCorrectionEffect", game.Lighting)
	local color2 = Instance.new("ColorCorrectionEffect", game.Lighting)
	
	color1.Enabled = true
	color1.Contrast = -1
	color1.TintColor = Color3.fromRGB(255, 0, 255)
	color2.Enabled = true
	color2.Contrast = -1
	color2.TintColor = Color3.fromRGB(255, 0, 255)
	task.wait(0.1)
	
	color1.Enabled = false
	color2.Enabled = false
	task.wait(0.48)
	
	color1.Enabled = true
	color1.Contrast = -9
	color1.TintColor = Color3.fromRGB(255, 0, 255)
	color2.Enabled = true
	color2.Contrast = -9
	color2.TintColor = Color3.fromRGB(255, 0, 255)
	task.wait(0.1)
	
	color1.Enabled = false
	color2.Enabled = false
end)

I have absolutely no idea how this is happening. Can you give a hint on why this could be happening? Thanks. And i put my RemoteEvents and Scripts in the Workspace because this is more of an test project rather than a serious one.

Hello, Do you get any errors or warnings? Do you use RemoteEvents? you have to use a RemoteEvent to trigger particle effects and sound playback on both the server and the client.

example:

-- Server Script

local remoteEvent = Instance.new("RemoteEvent", game.Workspace)
remoteEvent.Name = "PlayEffects"

-- Function to play particles and sounds
local function playEffects(position)
    -- Emit particles on server
    local smoke = fog:Clone()
    smoke.Parent = game.Workspace
    smoke.Position = position
    smoke.ParticleEmitter:Emit(3)

    -- Play sound on server
    local sound = Instance.new("Sound", workspace)
    sound.SoundId = "http://www.roblox.com/asset/?id=11984351"
    sound.Position = position
    sound:Play()
    
    -- Notify all clients to do the same
    remoteEvent:FireAllClients(position)
end

-- OnServerEvent listener (triggered by client)
game.Workspace.otherremote.OnServerEvent:Connect(function(player)
    local hrp = player.Character.HumanoidRootPart
    local position = hrp.Position + hrp.CFrame.LookVector * 3 + Vector3.new(0, 5, 0)
    
    -- Play effects on server
    playEffects(position)
end)

-- Client Script

local function playClientEffects(position)
    -- Play particles and sound on the client
    -- (Optional) Adjust this to play additional effects or to ensure the client sees the effects
end

game.Workspace.PlayEffects.OnClientEvent:Connect(playClientEffects)

What is the parameter “Position” supposed/is to be? I dont regularly use Functions so im not experienced with that.

I put a task.wait before the emit and sound and it works normally? Why does this fix it?