What I’d like for the player to do is play an animation/effects once the hitbox has touched the wall. I’ve accomplished something identical to that, except for one minor issue which is showcased in the video below; I’d like for the player to not teleport back a few studs upon reaching the wall, but stay attached to the wall.
I’ve already attempted to handle this process on the client, however I still receive similar issues as well as faulty replication and security. Being handled on the server is the most viable option for me right now.
Here’s what I’m currently working with:
coroutine.wrap(function()
local knockback_lifetime = 0.75;
local impact_hitbox = vfxF_RS.general.knockback['object_impact_hitbox'];
local force_delta = 500000; -- 500,000
local body_velocity = Instance.new('BodyVelocity');
body_velocity.MaxForce = Vector3.new(force_delta, force_delta, force_delta);
body_velocity.Name = 'body_velocity';
body_velocity.Velocity = plrCharacter['HumanoidRootPart'].CFrame.LookVector * 50;
body_velocity.Parent = victim_character['HumanoidRootPart'];
local impact_hitbox_clone = impact_hitbox:Clone();
impact_hitbox_clone.Parent = victim_character['HumanoidRootPart'];
impact_hitbox_clone:SetNetworkOwner(victim_character);
local impact_hitbox_weld = Instance.new('Weld');
impact_hitbox_weld.Part0 = impact_hitbox_clone;
impact_hitbox_weld.Part1 = victim_character['HumanoidRootPart'];
impact_hitbox_weld.Parent = impact_hitbox_clone;
debrisService:AddItem(body_velocity, knockback_lifetime);
debrisService:AddItem(impact_hitbox_clone, knockback_lifetime);
knockback_manager = impact_hitbox_clone.Touched:Connect(function(object_hit)
if (object_hit:IsDescendantOf(workspace['Azoth_WS'])) then
if (object_hit ~= victim_character) or (object_hit ~= plrCharacter) or (object_hit ~= impact_hitbox_clone) then
impact_hitbox_clone:Destroy();
local impact_Anim = animationsF_RS.general.punch['object_impact'];
local impact_Track = victim_humanoid['Animator']:LoadAnimation(impact_Anim);
local impact_boolVal = Instance.new('BoolValue');
impact_boolVal.Name = 'impact_immunity_bool';
impact_boolVal.Value = true;
impact_boolVal.Parent = victim_character['Convars'];
local impact_weld = Instance.new('WeldConstraint');
impact_weld.Name = 'impact_weld';
impact_weld.Part0 = object_hit;
impact_weld.Part1 = victim_character['HumanoidRootPart'];
impact_weld.Parent = object_hit;
debrisService:AddItem(impact_weld, impact_Track.Length);
debrisService:AddItem(impact_boolVal, combat_wrapper.game_values.other_values[1]);
impact_Track:Play();
knockback_manager:Disconnect();
end; -- object_hit ~= victim_character/plrCharacter condition.
end; -- object_hit:IsDescendantOf() condition.
end); -- impact_hitbox_clone.Touched()
end)(); -- coroutine.wrap()