You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
It says the instance is null it isn’t null.
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
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 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