Hello, I’ve been trying to make a moon by using an ‘ImageHandleAdornment’. Basically, I want to move the adorment to the sun’s position, but I’m not very good with CFrames and I just can’t seem to make things work.
Here’s my code so far:
local MoonHandle = PlayerGui.MoonHandleAdornment
MoonHandle.CFrame = (CFrame.new(workspace.CurrentCamera.CFrame.Position) + game:GetService("Lighting"):GetSunDirection() * DistFromCamera) -- this is where things are wrong
MoonHandle.Size = Vector2.new(game.Lighting.Sky.SunAngularSize, game.Lighting.Sky.SunAngularSize)
MoonHandle.Visible = true
If you’re wondering why I don’t just set the time to night, I’m making a fake day/night cycle where it’s actually always day. Thanks!
Bumping as I also need help with this!
sorry i havent checked devforum in a while, if you’re still looking for help let me know if this works for you
-- A LocalScript inside ReplicatedFirst
local ImageHandleAdornment = script:WaitForChild("ImageHandleAdornment") -- wherever your 'ImageHandleAdornment' is located
ImageHandleAdornment.Adornee = workspace:WaitForChild("Terrain")
ImageHandleAdornment.Parent = workspace:WaitForChild("Terrain")
game["Run Service"].Heartbeat:Connect(function()
local SunDirection = game:GetService("Lighting"):GetSunDirection() -- change this to 'GetMoonDirection()' if you want it to be where the moon is instead
ImageHandleAdornment.CFrame = CFrame.new(SunDirection * 10000, Vector3.new(0,0,0))
end)
you may have to make the ImageHandleAdornment quite big:
ImageHandleAdornment.Size = Vector2.new(SizeYouWant, SizeYouWant)