Hi, I want to change a attachment position but changing it does something like this:
which is not what I want, heres my script:
--(this is a local script)
local weapon = Char:FindFirstChild("Weapon")
local Attachment1 = weapon.End
local HRP = Target:FindFirstChild("HumanoidRootPart")
Attachment1.Position = HRP.Position
--(this runs everytime when a zombie is near the Char instance)
and heres the hierachy of the Char(the rig that the beam’s Attachment1 is connected to)
idk what’s wrong with my script, any help would be appreciated c:
If that’s a beam you should set Attachment0 to the turret’s attachment, and Attachment1 to a zombie’s attachment (possibly the one inside its HumanoidRootPart) which should be set to position 0,0,0 so it’s positioned at the middle of the part
Thanks for the reply bro, your solution is working really good but as you said that
so yes the beam is acting weirdly when the char orientation changes that’s the only bug now besides that its working really good and I have no idea how to fix it
I did tried that but that’s not working as I want because I want the beam and its attachment1 to tween between zombies but this solution doesn’t work as smoothly as want it to be.
Oh I see, you don’t want it to snap to the other zombies basically. Well, another solution I can offer is to use a small part with an attachment in it (which you’d use as Attachment1) and using PreRender/RenderStepped to lerp its position (lerping so it doesn’t just snap to the new position) to the target’s position
--(this is a local script)
local weapon = Char:FindFirstChild("Weapon")
local Attachment1 = weapon.End
local HRP = Target:FindFirstChild("HumanoidRootPart")
Attachment1.WorldCFrame= HRP.CFrame --change
--Use WorldPosition or WorldCFrame
--Attachment1.WorldPosition = HRP.Position
--(this runs everytime when a zombie is near the Char instance)
Yes, there is a delay between attacking enemies. I have put a cooldown between each attack to balance the game like every other td game does and this cooldown/delay is 1 sec.