Part disappearing after tween on server

Hello, i am currently having an issue where when i tween an object on the server, it tweens it, but like a second later it disappears. Its still there, because i checked the workspace and it wasnt gone, but it just acted like its Transparency was set to 1, even though it is still on 0. Note that this doesnt always happen, sometimes it doesnt but most the time it does.

Here is my code:

script.Parent.OnServerEvent:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local plrHum = char:FindFirstChild("Humanoid")
	local rp1 = char.HumanoidRootPart
	local victim,player = script.Victim,script.Player
	local hb = require(game.ReplicatedStorage.HitboxStuff.hitboxModule)
	local d = game:GetService("Debris")
	local KB = require(game.ReplicatedStorage.KnockbackModule)
	local plrPlay: AnimationTrack = plrHum:LoadAnimation(player)
	local loop = plrHum:LoadAnimation(script.Loop)
	local tween = game:GetService("TweenService")
	for i,v in pairs(plrHum:GetPlayingAnimationTracks()) do
		v:Stop()
	end
	plrPlay:Play()
	plrPlay:AdjustSpeed(.8)
	if plrHum:GetState() ~= Enum.HumanoidStateType.Freefall then
	plrHum.AutoRotate = false
	rp1.Anchored = true
	char:FindFirstChild("unstunned").Value = false
	else
		wait(1)
		plrHum.AutoRotate = false
		rp1.Anchored = true
		char:FindFirstChild("unstunned").Value = false
		
	end
	
	local domain = script.Domain:Clone()
	domain.Parent = rp1
	domain:Play()
	d:AddItem(domain, domain.TimeLength)
	local theme = script.Theme:Clone()
	theme.Parent = rp1
	plrPlay:GetMarkerReachedSignal("Pause"):Connect(function()
		loop:Play()
	end)
	
	wait(2)
	
	local sphere = script.InfVoidPart:Clone()
	sphere.Parent = workspace.Fx
	sphere.CFrame = rp1.CFrame * CFrame.new(0,-2,0)
	sphere.Script.Enabled = true
	
	
	local floor = Instance.new("Part") --issue
	floor.Shape = Enum.PartType.Cylinder
	floor.Anchored = true
	floor.BrickColor = BrickColor.new(255,255,255)
	floor.Material = Enum.Material.Neon
	floor.Parent = workspace.Fx.InfVoidPart
	floor.CFrame = rp1.CFrame * CFrame.new(0,-3,0)
	floor.Size = Vector3.new(1,1,1)
	floor.Orientation = Vector3.new(0, 90, 90)
	local returnpoint = Instance.new("Part")
	returnpoint.Parent = workspace.Fx
	returnpoint.Anchored = true
	returnpoint.CanCollide = false
	returnpoint.Size = Vector3.new(1,1,1)
	returnpoint.CFrame = rp1.CFrame * CFrame.new(0,-2,0)
	returnpoint.Transparency = 1
	
	local floorTween = tween:Create(floor, TweenInfo.new(1), {Size = Vector3.new(0,100,100)})--this is the tween that the issue is happening at
	floorTween:Play()
	
	wait(1)
		floor.Size = Vector3.new(0,100,100)
	
	local domain1 = game.ReplicatedStorage.Domain:Clone()
	domain1.Parent = workspace.Fx
	
	local domain2 = game.ReplicatedStorage["Infinite Void"]:Clone()
	domain2.Parent = workspace.Fx
	
	wait(4)
	
	theme:Play()
	plrPlay:AdjustSpeed(1)
	local fadeIn = tween:Create(theme, TweenInfo.new(0.5), {["Volume"] = 1.5})
	fadeIn:Play()
	local guiFadeOut = tween:Create(plr.PlayerGui.White.Frame, TweenInfo.new(.5), {BackgroundTransparency = 1})
	plr.PlayerGui.White.Frame.BackgroundTransparency = 0
	wait(.5)
	guiFadeOut:Play()
	
	char:PivotTo(domain1.CharTP.CFrame)
	local part = domain1.LookAtPart
	rp1.CFrame = CFrame.lookAt(rp1.Position, Vector3.new(part.Position.X, rp1.Position.Y, part.Position.Z))
	plrHum.AutoRotate = false
	rp1.Anchored = true
	
	wait(10)
	
	plr.PlayerGui.White.Frame.BackgroundTransparency = 0
	wait(.5)
	guiFadeOut:Play()
	
	
	domain2.CharTP.Position = domain2.CharacterPos.WorldPosition
	
	
	char:MoveTo(domain2.CharTP.Position)
	for i,v in pairs(plrHum:GetPlayingAnimationTracks()) do
		v:Stop()
	end
	plrHum.AutoRotate = true
	plrHum.WalkSpeed = 16
	plrHum.JumpPower = 50
	char.unstunned.Value = true
	rp1.Anchored = false
	local themeQuiet = tween:Create(theme, TweenInfo.new(1), {Volume = 0.5})
	themeQuiet:Play()
	wait(20)
	local fadeoutTheme = tween:Create(theme, TweenInfo.new(1), {Volume = 0})
	fadeoutTheme:Play()
	fadeoutTheme.Completed:Connect(function()
		d:AddItem(fadeoutTheme, 0)
	end)
	char:MoveTo(returnpoint.Position)
	d:AddItem(returnpoint, 1)
	d:AddItem(workspace.Fx.InfVoidPart, 0)
	d:AddItem(domain1, 0)
	d:AddItem(domain2, 0)
	
	
	end)

Dont mind the mess, but where im having my issue is the part that is marked with “Issue”
If anyone could help, it would be greatly appreciated.

1 Like

the part that im having issue is the white neon circle on the ground that appears shortly after the move starts

i dont know why thats happening, maybe its z-fighting.

also isnt this line pointless?

local floorTween = tween:Create(floor, TweenInfo.new(1), {Size = Vector3.new(0,100,100)})--this is the tween that the issue is happening at
	floorTween:Play()
	
	wait(1)
		floor.Size = Vector3.new(0,100,100) --This

if its not pointless then use this instead of wait()

local floorTween = tween:Create(floor, TweenInfo.new(1), {Size = Vector3.new(0,100,100)})--this is the tween that the issue is happening at
	floorTween:Play()
	
	floorTween.Completed:Connect(function()
		floor.Size = Vector3.new(0,100,100)
    end)

this way, it wont halt the thread.

also, great animation and effects, im guessing youre working on a JJK battlegrounds game right?

1 Like

yeah that was an attempt at fixing the issue. but what you wrote is what it was before i attempted

try filling the tweeninfo, i think the animation might be reversing after it finishes, since its not instant.

it was z fighting!! thanks man i dont know why i didnt think of this! what i did to fix was raise the circle/floor by 0.1 and it fixed!

im glad you got it fixed haha, best of luck to you.

whats the name of the game, ill definitely play it after you release it.

the name of the game is called “Cursed Legacy”! Wish you luck on all your projects!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.