Universal Script πŸ“Œ
1.9k Views
260 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
Universal Script πŸ“Œ
19
0
Approved 23 minutes ago
Script hub
192
991
Bumped 2 hours ago

Script hub

Lunyx Hub

Script hub
120.8k
221.3k
Bumped 3 hours ago
Key System
Script hub
10.6k
201.7k
Bumped 3 hours ago

Script hub

KeylessVerified script badgeIRIDIUM HUB | #1

Script hub
33.3k
300.4k
Bumped 6 hours ago
Script hub
23.8k
5.3k
Bumped 6 hours ago
Key System
Paid
High QualityΒ Offering