I have run into an issue with a part I have coded not replicating it's actions across all clients. The originating client calls to the server to run an event placing the part in the player's model as follows, welding the part to the player's right hand:
Bin.EVENT.OnServerEvent:Connect(function(player) local A = Bin.EVENT.Model:Clone() A.Parent = player.Character A.PrimaryPart.CFrame = player.Character.RightHand.CFrame local Weld = Instance.new("WeldConstraint") Weld.Name = "HANDWELD" Weld.Part0 = player.Character.RightHand Weld.Part1 = A.PrimaryPart Weld.Parent = A.PrimaryPart A.Script1.Disabled = false end)
This part works fine, I can see the model cloning to the player's model and all clients can see it attached to the player's hand and able to walk around and replicate fine. Now, Script1 as you see mentioned in the above code creates a lightning effect around the model's PrimaryPart (MAIN) using the following code:
local function Shoot(From,Too) local LastPos = From local Step = 1 local Off = 1 local Dist = (From-Too).Magnitude for i=1,Dist,Step do local Offset = Vector3.new(math.random(-Off,Off),math.random(-Off,Off),math.random(-Off,Off))/2 local From = LastPos local Too = From+-(From-Too).unit*Step+Offset local STK = Strike:Clone() STK.Parent = script.Parent STK.Size = Vector3.new(STK.Size.X,STK.Size.Y,(From-Too).Magnitude) STK.CFrame = CFrame.new(From:Lerp(Too,.5),Too) local Weld = Instance.new("WeldConstraint") Weld.Part0 = STK Weld.Part1 = script.Parent.PrimaryPart Weld.Parent = STK game.Debris:AddItem(STK,.1) LastPos = Too end end
Of course there is a looped series of code that continuously fires off this function, but the function itself is where I located the problem. The problem seems to be the weld (I have used a Weld and WeldConstraint with both resulting in the same issue). The issue that is occurring is when this function is fired to add lightning bricks around the PrimaryPart, the originating client can move around and see everything operating as normal; however, any other clients observing the originating player will only see them frozen in one spot. They can see the lightning effect working as well as the player's animations for walking, but the player themself is frozen until either A) Script1 is disabled and no longer firing these lightning effect bricks or B) the model itself is removed (of course).
If I run the code without the weld and let the lightning bricks just fall to the ground, the origin player and watching clients can see all actions as intended.
Is there an issue with the current handling? Any advice or alternate methods are welcomed! I will continue troubleshooting this and update here if I find any new handling methods or workarounds.
Thanks, Romul