I need help positioning this special part (I don't mind if its CFrame or Position + Rotation)

So basically, if any of you have played forsaken, basically in simple terms I am trying to create something similar to the 007n7 coolgui. The problem is, I can’t seem to get the rotation done correctly since I think its world so if I were to rotate or move it would mess up and look bad. I have a video below, first showing what’s supposed to happen, and then showing what would happen if I would move / turn my character. (sorry for bad quality)

And here is my code:

local ServerStorage = game:GetService("ServerStorage")
local tool = script.Parent
local event = tool:WaitForChild("saveGuiEvent")
local saveGui = ServerStorage.Models.SaveGui.SaveGui

event.OnServerEvent:Connect(function(player:Player,eventType:string)
	local character = player.Character
	local WeldConstraint = Instance.new("WeldConstraint")
	local arm = character:FindFirstChild("Right Arm")
	local torso = character:FindFirstChild("Torso")
	local saveGuiClone = saveGui:Clone()
	saveGuiClone.CFrame = arm.CFrame * CFrame.new(0,0,-2) * CFrame.Angles(math.rad(90),math.rad(180),0)
	WeldConstraint.Parent = arm
	WeldConstraint.Part0 = saveGuiClone
	WeldConstraint.Part1 = torso
	saveGuiClone.Parent = arm
end)

Don’t worry, tool activation is handled by a local script and you don’t have to worry about that. Also, I haven’t made them despawn yet but the video should give you a clear enough idea of the problem I am having. Also any tips / explanations on CFrame and position and rotation would help for clarification so I can do this better on my own in the future.

And yes, I am aware that its welded to the torso even though Its positioned relative to the arm, that’s because I don’t want it to move with the arm, but still be positioned relative to it.
Any help is appreciated!

To the person that just hearted this very post instead of making a response, why?

1 Like

Have you tried changing the position of the tool FROM the weld instead of its immediate CFrame?

What do you mean? I don’t quite understand.

Oh help my bad, not WeldConstraint. Have you tried using Motor6D instead? Its best to use it at a scenario like this

you can replace the arm’s cframe to

local newArmCFrame = CFrame.new(arm.Position) * CFrame.Angles(0, math.rad(arm.Orientation.Y), math.rad(arm.Orientation.Z))

this will cancel the x value when the arm swings.

or u can just use humanoid root part

I am confused, what is this supposed to do? Its not the arm itself moving thats the problem, its when I move the the world and it seems the position or the rotation is changing

i thought it was because the arm was moving, can u please define the “world” thing

Now analyzing, I think it actually was something to do with the arm, but my original suspicions was that it was somehow being rotated or positioned relative to the world somehow instead of the arm.

But I now have changed it so that it positions of the humanoid root part which has seemed to work perfectly, I just had to tweak the positioning slightly so that it still looks like how intended. I still kinda wish I could make the arm positioning work, but from multiple tweaks and even seing what chatgpt would tell me, nothing seemed to work with the arm so it is how it is.

This is how it now works currently:

And this is the new code:

local TweenService = game:GetService("TweenService")
local ServerStorage = game:GetService("ServerStorage")
local tool = script.Parent
local event = tool:WaitForChild("saveGuiEvent")
local saveGui = ServerStorage.Models.SaveGui.SaveGui
local saveGuiTweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Bounce,Enum.EasingDirection.InOut,0,false,0)
local saveGuiClone = nil

event.OnServerEvent:Connect(function(player:Player, eventType:string)
	local character = player.Character
	local arm = character:FindFirstChild("Right Arm")
	local torso = character:FindFirstChild("Torso")
	local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	if eventType == "Equip" then
		local WeldConstraint = Instance.new("WeldConstraint")
		saveGuiClone = saveGui:Clone()
		saveGuiClone.CFrame = humanoidRootPart.CFrame * CFrame.new(1.6,0,-2.25) * CFrame.Angles(math.rad(90),math.rad(180),0)
		WeldConstraint.Parent = humanoidRootPart
		WeldConstraint.Part0 = saveGuiClone
		WeldConstraint.Part1 = humanoidRootPart
		saveGuiClone.Parent = humanoidRootPart
	elseif eventType == "Unequip" then
		local weld = humanoidRootPart:FindFirstChild("SaveGuiWeld")
		saveGuiClone = humanoidRootPart:FindFirstChild("SaveGui")
		saveGuiClone:Destroy()
		weld:Destroy()
	end
end)

Still nonetheless, if you have any suggestions still post them in the 2 weeks of this post that is available.

thanks for ocnsidering my humanoid root part thing lol first actual time trying to help ppl out

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.