Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix Tween lag or how to make every player see a client sided tween?


I made this teleport script that teleports a player forward and leaves a part behind that is being tween animated

Whenever I would use it it would lag the whole game, I saw some solutions which are to make the tween client sided but How would everyone in the server see the tween? Is there a way to fix this without making the tween clientsided if not how do I make it so everyone else can see it?

clientsided Input script

local Plr = game.Players.LocalPlayer
local Char = Plr.Character
local Hum = Char:WaitForChild("Humanoid")
local HumRoot = Char.HumanoidRootPart

local remoteloc = game.ReplicatedStorage.InstantTransmision
local remote = game.ReplicatedStorage.InstantTransmision.Transmission
local R = remoteloc.FirstStage

local DB = false

local UIS = game:GetService("UserInputService")



UIS.InputBegan:Connect(function(input, IsTyping)
	if  DB == true then return end
	if IsTyping then return
		elseif input.KeyCode == Enum.KeyCode.LeftControl then	
			
		HumRoot.CFrame = HumRoot.CFrame + HumRoot.CFrame.LookVector*10
		remote:FireServer()
			

		end


end)

Serversided script

local remote = game.ReplicatedStorage.InstantTransmision.Transmission

remote.OnServerEvent:Connect(function(plr)
	local Char = plr.Character
	local Hum = Char:WaitForChild("Humanoid")
	local HumRoot = Char.HumanoidRootPart
	
	local partloc = game.ServerStorage.Classes.UnArmed.Transmission
	local Tp = partloc:Clone()
	Tp.Parent = workspace
	
	local TS = game:GetService("TweenService")
	local Info = TweenInfo.new(
		0.3,
		Enum.EasingStyle.Elastic,
		Enum.EasingDirection.Out,
		0,
		true,
		0
		
	)
	
	local goals = {
		
		Size = Tp.circ1.Size*1.5,
		
	}
	
	local goals2 = {
		
		Size = Tp.circ2.Size*1.5,
	
	}
	
	local goals3 = {

		Size = Tp.Union.Size*1.5,
		
	}
	
	local Tween = TS:Create(Tp.circ1, Info, goals)
	local Tween2 = TS:Create(Tp.circ2, Info, goals2)
	local Tween3 = TS:Create(Tp.Union, Info, goals3)
	
	Tween:Play()
	Tween2:Play()
	Tween3:Play()
	
	Tp.TransSound:Play()
	Tp.CFrame = HumRoot.CFrame + Vector3.new(0,3,0)
	
	game.Debris:AddItem(Tp, 1)
	
end)

1 answer

I don't know why it would be leggy server side but if it works client side then just do it on every client using a remote event to trigger them or something. But this is dangerous, the server wouldn't know and that's generally a bad thing. I highly recommend not doing this and instead seeing if you could make it not or less laggy server side. Possibly this can be done by compacting your code.

Hope this helps :3

This discussion is preserved as it was. New answers, comments, and votes are closed.