local part = script.Parent -- Reference to the part this script is in
local bobHeight = 0.3 -- How high the part will bob up and down
local bobSpeed = 2 -- Speed of the bobbing motion
local rotationSpeed = 2 -- Speed of the rotation in degrees per frame
local player = game.Players.LocalPlayer
local startPosition = part.Position
local timeElapsed = 0 -- Keeps track of the time for smooth bobbing
-- Function to update the part's position and rotation
local function updatePart()
local character = player.Character
local humRootPart = character.HumanoidRootPart
local offsetY = math.sin(timeElapsed * bobSpeed) * bobHeight
part.Position = humRootPart.Position + Vector3.new(0, offsetY, 0)
part.Orientation = part.Orientation + Vector3.new(0, rotationSpeed, 0)
-- Increment the time elapsed for smooth bobbing
timeElapsed = timeElapsed + wait(0.03)
end
-- Run the update function in a loop
while true do
updatePart()
end
** You are now Level 9! **