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?
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
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.