TweenService:Create failed because Instance is null (Instance is not null)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

It says the instance is null it isn’t null.
image

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

None

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

– Client

local TweenEvent = RemotesFolder:WaitForChild('TweenEvent')
local TweenService = game:GetService('TweenService')

local function Tween(obj, info, prop)
	return TweenService:Create(
		obj, 
		TweenInfo.new(info),
		prop
	)
end

TweenEvent.OnClientEvent:Connect(function(obj,info,prop)
	Tween(
		obj,
		info,
		prop
	):Play()
end)

– Server

local module = {}

local HitboxModule = require(script.Parent:WaitForChild('Hitbox'))
local ReplicatedStorage = game.ReplicatedStorage
local RemotesFolder = ReplicatedStorage:WaitForChild('Remotes')
local UseMove = RemotesFolder:WaitForChild('UseMove')
local VFXFolder = ReplicatedStorage:WaitForChild('VFX')
local HollowPurple = VFXFolder:WaitForChild('Hollow Purple')
local WorkspaceVFX = workspace:WaitForChild('VFX')
local TweenEvent = RemotesFolder:WaitForChild('TweenEvent')

UseMove.OnServerEvent:Connect(function(player, move)
	local lowered = string.lower(move)
	local character = player.Character
	local root = character:WaitForChild('HumanoidRootPart')
	
	if lowered == 'hollowpurple' then
		root.Anchored = true
		local newBlue = HollowPurple:WaitForChild('Blue'):Clone()
		newBlue.Parent = WorkspaceVFX
		newBlue.Position = root.Position - Vector3.new(10, 0, 5)

		local newRed = HollowPurple:WaitForChild('Red'):Clone()
		newRed.Parent = WorkspaceVFX
		newRed.Position = root.Position + Vector3.new(10, 0, -5)
		
		print(newRed.Name)
		print(newBlue.Name)
		
		TweenEvent:FireAllClients(
			newBlue,
			2, 
			{Position = newBlue.Position + Vector3.new(0, 0, 15)}
		)
		TweenEvent:FireAllClients(
			newRed,
			2, 
			{Position = newBlue.Position + Vector3.new(0, 0, -15)}
		)
	end	
end)

return module

2 Likes

You can try this post, I am not very familiar with TweenService unless it’s tweening transparency on vehicle running lights, I hope this helps!

Love,
Callan.

2 Likes

In this post they destroy the parts though. I never destroy the parts in my script.

I see, is your part anchored? I understand in some instances, they aren’t needed to be anchored.


Yes. Both of them are.

2 Likes

Could you try printing obj on the client? It could be getting nil or something else for some reason

1 Like

image
Found the issue. Why would I get that error though? Why is Obj nil on the client?

1 Like

Alright, I see, I usually use codes like this

local ts = game:GetService("TweenService")
local fadeDRL = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local fadeDRL2 = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local goal = {}
local goal2 = {}
local F = {}
local car = script.Parent.Parent.Parent.Parent

 script.Parent.Parent.Parent.Parent.Electrics.Changed:connect(function()
	if script.Parent.Parent.Parent.Parent.Electrics.Value == true then
		wait(0.5)
		drlFade(true)
	else
		drlFade(false)
	end
end)

function drlFade(bool)
		if bool then
			goal2.Transparency = 0
			local a = ts:Create(car.Body.DRLs.LDRL, fadeDRL, goal2)
			a:Play()
		else
			goal2.Transparency = 1
		local a = ts:Create(car.Body.DRLs.LDRL, fadeDRL, goal2)
			a:Play()	
		end
	end

F.drlFade = function(bool)
	drlFade(bool)
end

I am not totally familiar with this.

I hope you find your answer soon!

Have a great day!

1 Like

Youre trying to find Name in nil (nil.Name). I’m assuming you didn’t provide us with the code in that script

I did provide you with the code right here.

1 Like

Why are you handling that in a ModuleScript?

Because I want to handle it in a module script???

Try changing it to a server script

Its required by a server script. Dude its not changing to anything.

What type of instances are HollowPurple.Red and HollowPurple.Blue? Are their Archivable properties true?

Parts and Archivable is set to true on all of them.

Only thing I can think of is that the client can’t find the object.

It can I see blue and red under the folder on the client.

I did some testing and found the issue.
It takes some time for the newly cloned part to reach the client.
Add a small wait like task.wait() and it should work

image

image

2 Likes

Okay thanks. Ill put this as the solution.

1 Like