You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I have been trying to make some vfx for my game and they were running on server before, but I found that it will cause lag if the game have more players. So I am now trying to move my vfx stuff to Client. They were all working fine at server, just a bit laggy. -
What is the issue? Include screenshots / videos if possible!
Some vfx’s tween doesn’t play while some does, those which play are usually from one if statement and those which don’t play just bugged at the spot where it clones or don’t even show up.
Those yellow sparks are supposed to be hit effect which kinda have a tween that makes it has an explode animation. But it just stays there until the skill is over. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have read some post about client tweenservice, and I tried making a function which creates and play all tweens there but it didn’t work.
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!
VFX.OnClientEvent:Connect(function(arg,Character,info)
if arg == "Barrage" then --stuff here are working fine
local x1 ,y1 , x2,y2,Standusing = table.unpack(info)
local Stand = Character:FindFirstChild("Stand")
local standhumrp = Stand:FindFirstChild("HumanoidRootPart")
local wave = FX.HeavyHit:Clone()
wave.Parent = Character
wave.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(x1,y1,-2)
Debris:AddItem(wave,.35)
TweenService:Create(wave,TweenInfo.new(.35),{Size = Vector3.new(7,7,.5),Transparency = 1,CFrame = wave.CFrame * CFrame.Angles(0,0,math.rad(-90,90))}):Play()
local Character = Player.Character
local Stand = Character:FindFirstChild("Stand")
local standhumrp = Stand.HumanoidRootPart
local LeftArm = Instance.new("Model")
LeftArm.Name = "LeftArm"
local LUA = SS.StandModel:FindFirstChild(Standusing).LeftUpperArm:Clone()
LUA.Parent = LeftArm
LUA.Name = "Arm"
local LHand = SS.StandModel:FindFirstChild(Standusing).LeftHand:Clone()
LHand.Parent = LeftArm
LHand.Name = "Arm"
local LLA = SS.StandModel:FindFirstChild(Standusing).LeftLowerArm:Clone()
LLA.Name = "Arm"
local lweld1 = Instance.new("WeldConstraint")
lweld1.Part0 = LUA
lweld1.Part1 = LLA
lweld1.Parent = LHand
LLA.Anchored = true
LeftArm.PrimaryPart = LLA
LLA.Parent = LeftArm
local lweld = Instance.new("WeldConstraint")
lweld.Part0 = LHand
lweld.Part1 = LLA
lweld.Parent = LHand
local LeftArmd = LeftArm:GetDescendants()
for i, v in pairs(LeftArmd) do
if v:IsA("Attachment") or v:IsA("Motor6D") or v:IsA("ParticleEmitter") then
v:Destroy()
end
end
for i, partsinarm in pairs(LeftArmd) do
if partsinarm:IsA("MeshPart") or partsinarm:IsA("BasePart") then
partsinarm.Transparency = .3
partsinarm.Material = Enum.Material.Glass
TweenService:Create(partsinarm,TweenInfo.new(.35), {Transparency = 1}):Play()
end
end
LeftArm.Parent = Stand.Meshes
LeftArm.PrimaryPart.CFrame = CFrame.new(standhumrp.CFrame * CFrame.new(x1,y1,2).p,standhumrp.CFrame * CFrame.new(x1 *.5,y1 * .4,-6).p) * CFrame.Angles(math.rad(90),0,0)
local goal = {}
goal.CFrame = LeftArm.PrimaryPart.CFrame:lerp(LeftArm.PrimaryPart.CFrame * CFrame.new(0,-8,0) * CFrame.Angles(0,math.rad(math.random(-4500,4500)/100),0),1)
TweenService:Create(LeftArm.PrimaryPart,TweenInfo.new(0.35),goal):Play()
local RightArm = Instance.new("Model")
RightArm.Name = "RightArm"
local RUA = game:GetService("ReplicatedStorage").StandModel:FindFirstChild(Standusing).RightUpperArm:Clone()
RUA.Parent = RightArm
RUA.Name = "Arm"
local RHand = SS.StandModel:FindFirstChild(Standusing).RightHand:Clone()
RHand.Parent = RightArm
RHand.Name = "Arm"
local RLA = SS.StandModel:FindFirstChild(Standusing).RightLowerArm:Clone()
RLA.Parent = RightArm
RLA.Name = "Arm"
local rweld = Instance.new("WeldConstraint")
rweld.Part0 = RHand
rweld.Part1 = RLA
rweld.Parent = RHand
local rweld1 = Instance.new("WeldConstraint")
rweld1.Part0 = RUA
rweld1.Part1 = RLA
rweld1.Parent = RHand
RLA.Anchored = true
RightArm.PrimaryPart = RLA
local RightArmd = RightArm:GetDescendants()
for i, v in pairs(RightArmd) do
if v:IsA("Attachment") or v:IsA("Motor6D") or v:IsA("ParticleEmitter") then
v:Destroy()
end
end
local wave = FX.HeavyHit:Clone()
wave.Parent = Character
wave.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(x2,y2,-2)
TweenService:Create(wave,TweenInfo.new(.35),{Size = Vector3.new(7,7,.5),Transparency = 1,CFrame = wave.CFrame * CFrame.Angles(0,0,math.rad(-90,90))}):Play()
Debris:AddItem(wave,.35)
for i, partsinarm in pairs(RightArmd) do
if partsinarm:IsA("MeshPart") or partsinarm:IsA("BasePart") then
partsinarm.Transparency = .3
partsinarm.Material = Enum.Material.Glass
TweenService:Create(partsinarm,TweenInfo.new(.35),{Transparency = 1}):Play()
end
end
RightArm.Parent = Stand.Meshes
RightArm.PrimaryPart.CFrame = CFrame.new( standhumrp.CFrame * CFrame.new(x2,y2,2).p, standhumrp.CFrame * CFrame.new(x2 *.5,y2 * .6,-5).p) * CFrame.Angles(math.rad(90),0,0)
local goal = {}
goal.CFrame = RightArm.PrimaryPart.CFrame:lerp(RightArm.PrimaryPart.CFrame * CFrame.new(0,-8,0) * CFrame.Angles(0,math.rad(math.random(-4500,4500)/100),0),1)
TweenService:Create(RightArm.PrimaryPart,TweenInfo.new(0.35),goal):Play()
RightArm.Parent = Character
LeftArm.Parent = Character
Debris:AddItem(LeftArm,.35)
Debris:AddItem(RightArm,.35)
elseif arg == "DamageEffect" then --but these tween doesn't work somehow
local which,times,color = table.unpack(info)
local count = 0
repeat
count = count + 1
local spark = FX.Damage.sparkw:Clone() --it will only clone for the first time
if which == "Blood" then
spark.Color = FX.Damage.red.Color
elseif which == "Standhit" then
spark.Color = color
end
spark.Parent = Character
spark.CFrame = Character.HumanoidRootPart.CFrame
spark.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180))
TweenService:Create(spark,TweenInfo.new(.25),{CFrame = spark.CFrame * CFrame.new(0,0,math.random(300,600)/100 * -1),Size = Vector3.new(0.15, 0.15, 4)}):Play()
game:GetService("Debris"):AddItem(spark,.6) --also not destroying after .6sec, instead they destroy right after the skill is completed which is around 5 sec
delay(.35,function()
TweenService:Create(spark,TweenInfo.new(.25),{Size = Vector3.new(.05,.05,.05)}):Play()
end)
local yellow = FX.Damage.yellow:Clone()
yellow.Parent = Character
if which == "Blood" then
yellow.Color = FX.Damage.red.Color
elseif which == "Standhit" then
yellow.Color = color
end
yellow.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180))
yellow.CFrame = Character.HumanoidRootPart.CFrame
TweenService:Create(yellow,tweenInfofordamage2,{CFrame = yellow.CFrame * CFrame.new(math.random(300,400)/100 * -1,math.random(300,400)/100* -1,math.random(300,400)/100* -1),Size = Vector3.new(.25,.25,.25)}):Play()
game:GetService("Debris"):AddItem(yellow,.6)
delay(.45,function()
TweenService:Create(yellow,TweenInfo.new(.25),{Size = Vector3.new(0,0,0)}):Play()
end)
local ran = math.random(-400,400)/100
local black = FX.Damage.black:Clone()
black.Parent = Character
black.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180))
black.CFrame = Character.HumanoidRootPart.CFrame
TweenService:Create(black,tweenInfofordamage2,{CFrame = black.CFrame * CFrame.new(ran,ran,ran),Size = Vector3.new(.25,.25,.25)}):Play()
game:GetService("Debris"):AddItem(black,.6)
delay(.45,function()
TweenService:Create(black,TweenInfo.new(.25),{Size = Vector3.new(0,0,0)}):Play()
end)
local spark2 = FX.Damage.spark:Clone()
if which == "Blood" then
spark2.Color = FX.Damage.red.Color
elseif which == "Standhit" then
spark2.Color = color
end
spark2.Parent = Character
spark2.CFrame = Character.HumanoidRootPart.CFrame
spark2.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180))
TweenService:Create(spark2,tweenInfofordamage1,{CFrame = spark2.CFrame * CFrame.new(0,0,math.random(300,600)/100 * -1),Size = Vector3.new(0.15, 0.15, 4)}):Play()
game:GetService("Debris"):AddItem(spark2,.6)
delay(.35,function()
TweenService:Create(spark2,TweenInfo.new(.25),{Size = Vector3.new(.05,.05,.05)}):Play()
end)
until count == times
end
end)
-- since I'm just starting to handle vfx on clients, when I tried using other skills instead of the one which already have its vfx handled on client to activate the hit effect, it works perfectly
-- this is the code if needed
I’m not asking for rewriting my whole script, I just want to know what caused it.
I’m not sure if I missed anything that I should include, thx for reading.
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.