
1.9k Views
217 Executions
Hat orbit
Universal Script 📌
normspence34First script
1 year ago
Please login to perform these actions:Does it work?
No reports yetNo reports yet. Tried it? Be the first to say.
Also noticed:
Description
Hat orbit
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hat = game.Workspace:WaitForChild("Hat") -- Replace with the name of your hat
local head = character:WaitForChild("Head")
-- Parameters
local radius = 5 -- Orbit radius
local speed = 1 -- Speed of the orbit
local offset = Vector3.new(0, 5, 0) -- Adjust the Y offset if you want the hat higher or lower
-- Variables for controlling the orbit
local angle = 0
local orbiting = true
local mode = "orbit" -- Default mode is 'orbit'
-- Function to handle mode changes
local function setMode(newMode)
mode = newMode
print("Mode changed to: " .. mode)
end
-- Main loop to animate the hat
while true do
if mode == "orbit" then
-- Orbit Mode
local x = math.cos(angle) * radius
local z = math.sin(angle) * radius
hat.CFrame = head.CFrame * CFrame.new(x, offset.Y, z)
angle = angle + speed * math.rad(1)
elseif mode == "bounce" then
-- Bounce Mode (Vertical bounce up and down)
local time = tick()
local y = math.sin(time * speed) * 5 -- Change '5' to control bounce height
hat.CFrame = head.CFrame * CFrame.new(0, offset.Y + y, 0)
elseif mode == "spin" then
-- Spin Mode (Spin around player's head)
local time = tick()
local rotation = math.rad(time * 100) -- Adjust speed of spinning
Comments
0Log in to join the conversation. Login
No comments yet. Be the first!







