Universal Script 📌
1.9k Views
217 Executions

Hat orbit

Universal Script 📌
normspence34
normspence34First script
1 year ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

Hat orbit

View Raw
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

0
Log in to join the conversation. Login
No comments yet. Be the first!

More universal scripts

See all
Script hub
158.0k
496.6k
Bumped 26 minutes ago
Key System

Script hub

Hall of Fame #6

Verified script badgeAcro Hub OP SCRIPT

Universal Script 📌
597.6k
4.2M
Bumped 1 hour ago
Script hub
50.9k
320.4k
Bumped 3 hours ago

Script hub

Nameless Admin

Script hub
176.8k
1.6M
Bumped 5 hours ago
Key System
Script hub
46.8k
11.6k
Bumped 7 hours ago
Key System
Paid