goes from day to night automaticaly
Step.1 = In Explorer, right-click on ServerScriptService and select Script.
Rename the script to "DayNightCycle" if you'd like.
Step.2 = in the script copy and paste this (ctrl+c copy/ctrl+v paste)
SCRIPT (dont copy this word)
local Lighting = game:GetService("Lighting")
-- Customize cycle length in seconds
local dayDuration = 600 -- Full cycle duration (10 minutes here)
-- Set up initial conditions
Lighting.ClockTime = 6 -- Starts at morning (6 AM)
while true do
-- Advance the clock time based on the duration of the cycle
Lighting.ClockTime = (Lighting.ClockTime + (24 / dayDuration)) % 24
-- Adjust other Lighting properties if desired
if Lighting.ClockTime >= 6 and Lighting.ClockTime < 18 then
-- Daytime settings
Lighting.Brightness = 2
Lighting.OutdoorAmbient = Color3.fromRGB(255, 255, 255)
else
-- Nighttime settings
Lighting.Brightness = 0.5
Lighting.OutdoorAmbient = Color3.fromRGB(50, 50, 80)
end
-- Wait a short interval to make the cycle smooth
wait(1) -- Adjust to control cycle smoothness
end
dayDuration is the length of the full day-night cycle in seconds. You can adjust this value to make the cycle faster or slower.
Lighting.ClockTime is adjusted continuously, making the time of day move forward.
Lighting.Brightness and Lighting.OutdoorAmbient settings change depending on whether it's day or night, allowing for different appearances.
Cycle Duration: Increase dayDuration for a slower cycle or decrease it for a faster one.
Lighting Properties: Customize Brightness, OutdoorAmbient, or even add effects like fog during night hours to enhance the atmosphere.
you can change the time in day duration
does not apply to the player only the rig
Open Roblox Studio and go to the Plugins tab.
Select Animation Editor.
Select the rig (make sure it’s an R6 or R15 rig that’s compatible with animations).
Use the Animation Editor to create your animation. Once you’re done, name and save the animation.
Export the animation and save the Animation ID that Roblox gives you.
In Explorer, add a Script under the rig (or in ServerScriptService if you’re playing it on a character).
Here’s a sample script to loop the animation:
local rig = script.Parent -- Make sure this points to your rig
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://YOUR_ANIMATION_ID" -- Replace with your animation ID
local animator = rig:FindFirstChild("Animator") or rig:WaitForChild("Humanoid"):WaitForChild("Animator")
local animationTrack = animator:LoadAnimation(animation)
-- Set looped and play the animation
animationTrack.Looped = true -- Ensures the animation will repeat
animationTrack:Play() -- Start the animation
running, walking, jumping, idle, falling
By default, Roblox provides basic animations for jumping, falling, walking, running, climbing, and idle. These are automatically applied to characters in most games.
If you want custom animations, you can replace the default ones using an AnimationController and a Script. Here’s how:
Find/Create the Animation IDs:
If you want to use custom animations, create your own using Roblox Studio’s Animation Editor or find animations in the Toolbox. Each animation has a unique ID, which you’ll need.
Insert the Animations:
Open StarterPlayer in the Explorer panel.
Insert a LocalScript inside StarterPlayerScripts (this will ensure the script runs on each player).
In the LocalScript, use the following template to load custom animations:
-- Animation IDs
local runAnim = "rbxassetid://RunAnimationID"
local jumpAnim = "rbxassetid://JumpAnimationID"
local fallAnim = "rbxassetid://FallAnimationID"
local walkAnim = "rbxassetid://WalkAnimationID"
-- Replace default animations
local function replaceAnimation(animName, animID)
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local anim = Instance.new("Animation")
anim.Name = animName
anim.AnimationId = animID
-- Override the humanoid's animation
humanoid:FindFirstChildOfClass("Animator"):LoadAnimation(anim)
end
replaceAnimation("WalkAnim", walkAnim)
replaceAnimation("RunAnim", runAnim)
replaceAnimation("JumpAnim", jumpAnim)
replaceAnimation("FallAnim", fallAnim)
To make your own animations, use the Animation Editor:
Open the Animation Editor by selecting it from the Plugins tab.
Select a Rig (e.g., BlockRig or R15 Rig) to animate.
Create frames to animate movements like walking, jumping, or running.
Save and upload your animation to get an Animation ID.
After adding or replacing animations, click Play in Roblox Studio to test the animations in your game.
Ensure all animations transition smoothly between actions like running to jumping or walking to idle.