Hello all, I’ve been using this module called TweenServicePlus. Everything worked fine until it started teleporting rather than ACTUALLY tweening. I have no idea as to what caused this, it worked perfectly in a fresh baseplate but when I tried implementing it in my actual game it didn’t.
Context:
I am making a 2D Fighting game and this is the code used to process hitbox collisions:
['ProcessHitbox'] = function(player: Player, DataPacket: {
Name: string,
OriginCFrame: CFrame,
Size: Vector3,
}
)
-- Dependencies
local HitboxService = Titan:GetService("HitboxService").new()
local AnimationHandler = Titan.AnimationHandler
local TestMovesetFunctions = require(game.ReplicatedStorage.Client.Data.TestMovesetServer)
-- Main Variables
local Character: Model = player.Character or player.CharacterAdded:Wait()
-- Function to grab all parts inside of a player's character
local function getCharacterPartsAndHurtBoxes(Character)
local blackListTable = {}
for _, parts: Part in pairs(Character:GetChildren()) do
if not parts:IsA("Folder") then
table.insert(blackListTable, parts)
end
end
for _, hurtboxes: Part in pairs(Character:WaitForChild('HurtBoxes'):GetChildren()) do
table.insert(blackListTable, hurtboxes)
end
return blackListTable
end
-- Function to grab the Enemy Player
local function grabEnemyPlayer()
local EnemyPlayer: Player
for _, players: Player in pairs(game:GetService("Players"):GetPlayers()) do
if players.Name ~= player.Name then
EnemyPlayer = players
break
end
end
return EnemyPlayer
end
-- Datapacket Variables
local HitboxCFrame = DataPacket.OriginCFrame
local HitboxSize = DataPacket.Size
-- Overlap Params
local OverlapParamsCustom = OverlapParams.new()
OverlapParamsCustom.FilterType = Enum.RaycastFilterType.Exclude
OverlapParamsCustom.FilterDescendantsInstances = getCharacterPartsAndHurtBoxes(Character)
-- Actual processing.
HitboxService:ProcessCollision(HitboxCFrame, HitboxSize, OverlapParamsCustom, function(HitContents)
for _, v: Part in pairs(HitContents) do
if v.Parent.Name ~= player.Name then -- Check if it hit an enemy
local EnemyPlayer = grabEnemyPlayer()
local EnemyCharacter: Model = EnemyPlayer.Character or EnemyPlayer.CharacterAdded:Wait()
local EnemyHRP: Part = EnemyCharacter.PrimaryPart
-- Raycast Info
local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Exclude
RayParams.FilterDescendantsInstances = getCharacterPartsAndHurtBoxes(EnemyCharacter)
local ray = workspace:Raycast(EnemyHRP.Position, -EnemyHRP.CFrame.LookVector*5, RayParams)
TestMovesetFunctions[DataPacket.Name].Action(EnemyPlayer, ray)
break -- Make sure the function doesn't execute for every part
end
end
end)
end,
This is the moveset code:
local TestMoveset = {
["Punch"] = {
Action = function(specifiedPlayer: Player, ray: RaycastResult)
local enemyCharacter = specifiedPlayer.Character or specifiedPlayer.CharacterAdded:Wait()
local enemyHRP: Part = enemyCharacter:WaitForChild('HumanoidRootPart')
local enemyHumanoid: Humanoid = enemyCharacter:WaitForChild('Humanoid')
local newCFrame = (enemyHRP.CFrame - enemyHRP.CFrame.LookVector*1.5)
Animator:LoadAllAnims(enemyHumanoid)
Animator:StopAllTracks()
task.spawn(function()
Stun(specifiedPlayer, enemyCharacter, 0.5, "Stunned")
end)
Animator:GetTrack("Stunned"):Play()
local Tween = ReplicatedTweening:Construct(enemyHRP, TweenInfo.new(0.3, Enum.EasingStyle.Quad), {CFrame = newCFrame})
Tween:Play(nil, 15000)
end,
}
}
If you want more context on how the game is setup, you can download the rbxl file and see for yourself. (And yes I did add the local script in startercharacterscripts to require the moduel)
Whynowork.rbxl (354.6 KB)