Any way to Prevent Instances from not being loaded?

task.wait(.1)
--SPOOK 20/06/23
local ts = game:GetService("TweenService")

local rep = game:GetService("ReplicatedStorage")
local FolderR = rep:WaitForChild("Remotes")
local TweenRemote = FolderR:WaitForChild("Tween")

TweenRemote.OnClientEvent:Connect(function(instance, tweeninfo, properties)
	if instance ~= nil then
		local newinfo = TweenInfo.new(table.unpack(tweeninfo))
		local tween = ts:Create(instance, newinfo, properties)
		if tween.PlaybackState == Enum.PlaybackState.Playing then
			tween:Destroy()
		end
		tween:Play()
		return tween
	else
		return warn("Instance Doesn't exists.")
	end
end)


The part you are tweening should be anchored (via welds / motor6ds or property).
Put the part in a group and set the group’s ModelStreamingMode to Persistent

Okay, I did that things, But it still prints the instance doesn’t exist

Can you show
RemoteEvent:FireClient(...) on the server

Oh that’s because CollectionService loads faster on the server than the client, instead of sending the instance through the remote you should create a variable of it on the client and basically do this:

local CollectionService = game:GetService("CollectionService")

local MENU_CAMERA_PART_Tag = "_MenuCameraPart"

if #CollectionService:GetTagged(MENU_CAMERA_PART_Tag) < 1 then
	repeat task.wait() until #CollectionService:GetTagged(MENU_CAMERA_PART_Tag) >= 1
end

local cameraPart = CollectionService:GetTagged(MENU_CAMERA_PART_Tag)[1]
print(cameraPart)

on the client when the remote is fired and use it as the instance of the tween

1 Like

Yeah, i would need to do many things to make that work, So i’ll stick on what i have now, Anyways, if there is any other fixes, that would be good