I have a model located in my ServerStorage. A server script will clone this model when the user presses a key, and the model will move outward from the player using TweenService. For some reason, the first time a player in the game presses the key to clone and move the model, the model doesn't appear until halfway through the tween or sometimes not at all. After this first occurrence, the clone works as expected...
My guess is the model is being cached internally which is why I am only experiencing this on the first occurrence. Has anyone else run into something similar / know of a way to fix this?
The event:
local Workspace = game:GetService("Workspace")
local ServerStorage = game:GetService("ServerStorage")
local arrow_model = ServerStorage:WaitForChild("Models"):WaitForChild("Arrow")
function getArrowTween(arrow, numBlocks, endPos)
local arrowTime = (numBlocks * 0.09)
local arrowInfo = TweenInfo.new(
arrowTime,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local arrowProps = { Position = endPos; }
return TweenService:Create(arrow, arrowInfo, arrowProps)
end
ShootArrow.Event:Connect(function(startPos, endPos, lookDir, color)
--create arrow
local arrow = arrow_model:Clone()
arrow.Parent = Workspace
arrow.Position = startPos
arrow.Orientation = Vector3.new(0, orient, -90)
arrow.Color = color
--create and play tween
local arrowTween = getArrowTween(arrow, numBlocks, endPos)
arrowTween:Play()
arrowTween.Completed:Connect(function(playbackState)
if playbackState == Enum.PlaybackState.Completed then
arrow:Destroy()
end
end)
end)

3 comments
Can you paste the script by editing your post?
updated
im thinking of maybe tweening the CFrame instead of Position?