Hey everyone,
I have no idea what is going on with Align Position. I am not sure why replication behavior is different between the client and server. Any help or clarification would be greatly appreciated!
Serverside:
https://gyazo.com/9bc435eb943985fbcb908b4324af8369
Clientside:
https://gyazo.com/b1fc1e57ab377cb1f536168fd5ba3d56
Code:
I am simply attaching the players pet model align position to the enemies attachment. Not sure why everything is fine on the client while on the server the pet floats even when the attachment is not floating. If I enable RigidityEnabled, replication is fine between the server and client. I wish to create tween effects and enabling Rigidity takes away from the smoothness.
function PlayerPetManager.StartAttack(player, target)
pet.PrimaryPart:SetNetworkOwner(nil)
local petBase = target.Parent.PetBase
local attachment, pos = nil
if not petBase.Position1:GetAttribute("Active") then
attachment = petBase.Position1
petBase.Position1:SetAttribute("Active", true)
pos = petBase.Position1
elseif not petBase.Position2:GetAttribute("Active") then
attachment = petBase.Position2
petBase.Position2:SetAttribute("Active", true)
pos = petBase.Position2
elseif not petBase.Position3:GetAttribute("Active") then
attachment = petBase.Position3
petBase.Position3:SetAttribute("Active", true)
pos = petBase.Position3
elseif not petBase.Position4:GetAttribute("Active") then
attachment = petBase.Position4
petBase.Position4:SetAttribute("Active", true)
pos = petBase.Position4
end
if not attachment then
print("no room to attack mob")
return
end
pet.PetBase.AlignOrientation.Attachment1 = attachment
pet.PetBase.AlignPosition.Attachment1 = attachment
local trail = replicatedStorage:WaitForChild("Misc"):WaitForChild("PetDirection"):Clone()
trail.Parent = pet.PetBase
trail.Attachment0 = pet.PetBase.Attachment
trail.Attachment1 = petBase.TargetAttachment
-- Queue attack in coroutine
PetStatus[player.Name] = true
coroutine.wrap(function()
wait(2) -- let pet arrive to mob
--pet.PetBase.AlignPosition.RigidityEnabled = true
while wait(2.5) do -- attack interval
-- attack sequence
end
end)()
end
All the best,
deshea9