Tweening a part created on server error: "TweenService:Create failed because Instance is null "

i have created a part in the server, then i send that part through a remote to the client to then tween the part on the client rather than the server but when i do this i get the error ("TweenService:Create failed because Instance is null ")

1 Like

It’d be cool if there was a script so we can know what the exact issue is

2 Likes

cant send the whole script but i can give parts that are needed,

--server

game.ReplicatedStorage.Build:FireAllClients(Block, SnapHRP.X, SnapHRP.Y, SnapHRP.Z)


--client


game.ReplicatedStorage.Build.OnClientEvent:Connect(function(Block, MousePosX, MousePosY, MousePosZ)
	BuildUpTween(Block, MousePosX, MousePosY, MousePosZ, true)
end)

-- 

local function BuildUpTween(Block, MousePosX, MousePosY, MousePosZ, FromServer)

	local goal = {}
	goal.Size = Vector3.new(GridSnap, GridSnap, GridSnap)
	goal.Position = Vector3.new(MousePosX, MousePosY, MousePosZ)

	local tweenInfo = TweenInfo.new(
		0.1


	)

	--	print("MOUSE POS")

	local tween = TweenService:Create(Block, tweenInfo, goal)

	tween:Play()

Can we see where you reference Block? Also, can you print(Block) in the .OnClientEvent function?

here is the “block”

local Block = game.ReplicatedStorage.Blocks.Block:Clone()

		Block.Parent = workspace
		Block.Position = Vector3.new(SnapHRP.x, SnapHRP.Y - (1.5), SnapHRP.Z)
		Block.Size = Vector3.new(3,0,3)
		Block.CanCollide = false
		Block.Transparency = 0
		Block.HitBox.Position = SnapHRP
		Block.HitBox.CanQuery = true
		Block.CanQuery = true
		Block.CanCollide = true
		Block.InnerHitbox.Position = SnapHRP
		Block.Health.Position = SnapHRP
		spawn(function()
			task.wait(0.15)
			Block.Size = Vector3.new(3,3,3)
		end)
		game.ReplicatedStorage.Build:FireAllClients(Block, SnapHRP.X, SnapHRP.Y, SnapHRP.Z)

and it prints nothing

can anyone help i’m really stuck

Maybe the block just fall out of map, try to set Anchored to true.

its anchored and i can see it in workspace and infront of me

Is the property which is on workspace called “streaming enabled” set to true, if so then this might cause the issue, because if it’s enabled its possible that the part hasn’t been streamed to the client yet, which also causes the error in the output.

Consider checking if its set to true and if thats the case, then I recommend you to set it to false to possibly prevent this error.

4 Likes

thank you so much, i was wondering why it worked in test game but not in the real game

2 Likes

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