I want to make a gui like shown in this video but for a main menu. How do I make gui sway like this when moving the camera.
1 Like
look at the mess I did
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local Frame = script.Parent -- change it
local FramePosition = Frame.Position
local FrameOffset = FramePosition
local X, Y = {["Goal"] = 0, ["Tween"] = nil, ["Value"] = Instance.new("NumberValue")}, {["Goal"] = 0, ["Tween"] = nil, ["Value"] = Instance.new("NumberValue")}
RunService.RenderStepped:Connect(function(Deltatime)
local MouseDelta = UserInputService:GetMouseDelta() * 0.5
if X.Goal ~= MouseDelta.X then if X.Tween then X.Tween:Pause() end X.Goal = MouseDelta.X X.Tween = TweenService:Create(X.Value, TweenInfo.new(0.2), {["Value"] = MouseDelta.X}) X.Tween:Play() end
if Y.Goal ~= MouseDelta.Y then if Y.Tween then Y.Tween:Pause() end Y.Goal = MouseDelta.Y Y.Tween = TweenService:Create(Y.Value, TweenInfo.new(0.2), {["Value"] = MouseDelta.Y}) Y.Tween:Play() end
FrameOffset = UDim2.fromOffset(
X.Value.Value,
Y.Value.Value
)
--print(FrameOffset)
--print(CameraRotation)
Frame.Position = FramePosition + FrameOffset
end)
7 Likes
thank you very much, I will use it
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.