Code:
for i = 1,3,1 do local ray = Ray.new(char.HumanoidRootPart.CFrame.p, mouse.p) local trident = game.ReplicatedStorage.Trident:Clone() trident.BrickColor = BrickColor.new("Bright blue") trident.Material = Enum.Material.Neon trident.CanCollide = false trident.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(0,3,0) trident.CFrame = CFrame.new(trident.CFrame.p,mouse.p)*CFrame.Angles(0,math.rad(180),0) trident.Parent = char local BV = Instance.new("BodyVelocity") BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BV.Velocity = ray.Direction*1 BV.Parent = trident wait(2) end
FOR LOOPS. I've been trying to figure out the problem but I'm still just a beginner. In this code the trident should have different directions depending on where the mouse is pointed at, right? WELL NO! MY TRIDENTS HAVE DECIDED TO FOLLOW THE FIRST POSITION THEY WENT THROUGH. How do I fix this?
So I found out why it was only facing one direction. I checked the local script and the problem was there. The local script fires the ~~~~~~~~~~~~~~~~~ event:FireServer(mouse.Hit) ~~~~~~~~~~~~~~~~~ only once, thus causing the problem.
mouse.Hit.p not mouse.p