Hello, I just want set part to be like a humanoidrootpart
But I using lookvector but it don’t do anything here is script I’m doing
while wait(0.00001) do
script.Parent.Setting.Position = script.Parent.Idk.WorldPosition
script.Parent.Setting.Orientation = script.Parent.Parent.HumanoidRootPart.CFrame.lookVector
end
Could you please explain the context of what you’re trying to create? I think people would find it easier to solve your problem if they understood what you’re trying to do a little better. Also a helpful tip for the future would be to make your images a lot more clear, I’m not the most intelligent person by all means but the diagram is quite confusing.
You should consider using the CFrame mechanic “ToWorldSpace” along with an offset CFrame. ToWorldSpace is a method which moves the object to a position in the world relative to another part (in this case the player’s character) and applies and offset to move it in front.
Quick tip: wait() has a minimum value of 0.03, going below that is pointless. use game:GetService("RunService").RenderStepped/Heartbeat instead, renderstepped is fired each frame and heartbeat goes at 60 runs per second
RenderStepped and Heartbeat have variable frequencies depending on the client’s performance. If your game is running very slowly and at say, 15 fps, both events would fire 15 times per second and not necessarily 60fps.
The only difference is that RenderStepped runs immediately when the frame is stepped, before any of Roblox’s physics simulations. Heartbeat is the same, however it waits for Roblox’s physics simulations to be completed before running any code associated to it.
What exactly is your expected outcome? Is it that the blue part is too long? I’m not sure what would qualify as success at the moment. Have you tried manipulating the dimensions of the part in question to make it fit more with your plans?
My main point is that he seemed to be trying to get a “weld” like effect, at least visually. renderstepped does that. I’m aware that renderstepped runs slower, but i didn’t know heartbeat was also bound to physics. but hey, the more you know
Hello, It’s just not correct position so I want do magic beam from your head and when is touch somebody player it kill him , In total I got 2 problem 1.Position is not correct 2. I need longer it only on one side
Have you considered using Raycasts? Raycasts are essentially a beam that is infinite in one direction but finite in the other, you could use a Ray to create the lightning bolt itself and you could add a Touch event to any parts associated along the Ray to check whether the beam is actually hitting anyone.
Alternatively you could use the Target property of the Player’s Mouse to determine whether the player has hit a Humanoid model. This becomes automatic and could potentially lead to issues such as players shooting through walls however seems like it would be functional for what you’re trying to achieve.
Raycasting is something that can be quite complex and needs a lot of patience and getting used to, this guide will get you up to speed on it pretty quicker (just imagine the player’s head is the gun in this instance): Documentation - Roblox Creator Hub
For references about Raycasting in the Roblox engine, read this article:
For references about the Mouse method, read this article:
Scripting is all about perseverance, it’s not impossible to learn how to Raycast and it will give you an edge on your games if you can successfully figure it out. Have a look at how successful Raycasts are done in the examples I’ve sent above, and if you get errors just research what could have caused the errors. There are plenty of guides, tutorials and people out there willing to lend a hand.