Can't pass model created on server to client for some reason

I’m working on a skill that spawns a small pillar of ice in front of the users. I’m cloning the model from ReplicatedStorage and immediately parenting it to workspace, underneat the terrain and in front of the player. That’s because I immediately fire a remote to all clients, to animate the pillar so it looks like it’s “raising”/“growing” from the ground. I’m using TweenService to do it and doing it on the client for optimization’s sake.

Unfortunately, when I pass the arguments to the client (ice pillar model, player’s HRP and the final CFrame that the ice model must be tweened to), the pillar model results nil\non-existing and I have no idea why because it makes no sense, since the skill worked in the past but not anymore, after I resumed working on it after a few weeks.

Here is the relevant code:

SERVER CODE - clones pillar model and places it in front of the player, slightly under the terrain and calculates the final CFrame for the client to tween to.

function spell:Cast(plr,result)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local HRP = char:FindFirstChild("HumanoidRootPart")
	local diskModel : Model = vfxModule:FindFirstChild("IceDisks")
	local iceDisks : Model = diskModel:Clone()

	local finalCF = CFrame.new(HRP.Position + HRP.CFrame.LookVector * 3 - Vector3.new(0,3.5,0)) * CFrame.Angles(0,0,math.rad(90))
	iceDisks:PivotTo(CFrame.new(HRP.Position + HRP.CFrame.LookVector * 3 - Vector3.new(0,10,0)) * CFrame.Angles(0,0,math.rad(90)))
	iceDisks.Parent = game:GetService("ReplicatedStorage") --tried both workspace and RS, both result nil on the client.
	print(iceDisks) --returns the model on the server, as expected.

	Service.Remotes.vfxReplicator:FireAllClients(vfxModule,"risePillar",iceDisks,HRP,finalCF)
--i use a client replicator, as seen here.

end

CLIENT VFX PART - it’s a module script parented to ReplicatedStorage.

actions["risePillar"] = function(var) --water form
	
	print(var) --all values sent from the server exist, except for iceDisks, which results "void"
	local iceDisks : Model = var[2] --returns void\nil for some reason
	local HRP = var[3]
	local finalCF = var[4]

	iceDisks.Parent = workspace:WaitForChild("Bullets") --errors, saying i'm trying to parent nil to workspace.Bullets.
	iceDisks.PrimaryPart = iceDisks:FindFirstChild("Base") --also couldn't find the parts.
	local CFValue = Instance.new("CFrameValue")
	CFValue.Value = iceDisks.PrimaryPart.CFrame
	CFValue.Parent = iceDisks

--tweening stuff.
	local riseTween = Service.TS:Create(CFValue,TweenInfo.new(1),{Value = finalCF})
	CFValue:GetPropertyChangedSignal("Value"):Connect(function()
		iceDisks:PivotTo(CFValue.Value)
	end)

	riseTween:Play()
	riseTween.Completed:Connect(function()
		CFValue:Destroy()
	end)
end


--What the VFX module returns
return function(...)
	local var = {...} --variadic function
	local action = var[1] --in this case "risePillar"

	actions[action](var)

end

VFX REPLICATOR SCRIPT - adding it just in case, but I know this isn’t the problem cuz the other skills work just fine.

local Service = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("Services"))

Service.Remotes:WaitForChild("vfxReplicator").OnClientEvent:Connect(function(Module, ...)
	local moduleF = require(Module)
	moduleF(...)

end)

In the scripts you’ll find some comments explaining what the code does; also here is a screenshot of the console:

image

That is one complicated module structure.

I have replicated to my studio and found no issues with the remote or model, however that is assuming certain things are changed such as replacing the :FindFirstChild as I don’t have your IceDisks model and setup.

Is Archivable property turned on by any chance?

This is what I used to test in my studio:

--Server script emulating spell cast
local spell = {}

local vfxModule = (game.ReplicatedStorage.ModuleScript)

function spell.Cast(result)
	local diskModel : Model = Instance.new("Model")
	local iceDisks : Model = diskModel:Clone()

	iceDisks.Parent = game:GetService("ReplicatedStorage") --tried both workspace and RS, both result nil on the client.
	print(iceDisks) --returns the model on the server, as expected.

	game.ReplicatedStorage.RemoteEvent:FireAllClients(vfxModule,"risePillar",iceDisks)
	--i use a client replicator, as seen here.

end

while true do
	task.wait(1)
	print("Cast")
	spell.Cast()
end
--Client script, replicator unchanged
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(Module, ...)
	local moduleF = require(Module)
	moduleF(...)

end)
--the vfx module
local actions = {}
actions["risePillar"] = function(var) --water form

	print(var) --all values sent from the server exist, except for iceDisks, which results "void"
	local iceDisks : Model = var[2] --returns void\nil for some reason
	print(iceDisks)

	local HRP = var[3]
	local finalCF = var[4]

end


--What the VFX module returns
return function(...)
	local var = {...} --variadic function
	local action = var[1] --in this case "risePillar"

	actions[action](var)

end

Output, model is there:

image

Remote structure, just a remote in replicated storage and vfx module there:

image

Yes, it is for the IceDisks model. I tried disabling it just now, it errors:
image

Your structure seems similar, except the Replicator local script is inside the PlayerScripts. I truly have no idea why yours is working but mine isn’t, especially when until a few weeks ago it was working just fine…

Whoops mistake archivable is supposed to be turned on, probably the problem is not related to that.

Have you tried viewing the Instance tree in server and client view? I was able to replicate void by not parenting the model instance to replicated storage.

Otherwise topic aside shouldn’t the VFX be made only on the client?

Yes of course - the model is present both on the client and server.

I’m now parenting it to Workspace and it still produces the same result…

Yes, but I need the pillar present on the server for reasons unrelated to the issue lol

Bump, still no idea what is not working lol.