#Clock with cframe.PivotOffset
1 messages · Page 1 of 1 (latest)
try to multiply the old CFrame by the
CFrame.fromEulerAnglesXYZ(...)
I think your setting the position to 0,0,0
check the position of your hand in the explorer
I think if you dont multiply it sets the position to 0,0,0 but idk I had a similar issue
yeah i multiplied it now
my game operates in rounds
rather than having a remoteevent / bindable event to communicate which maps is getting switched when i just made an inst value
alr lets just concentrate on the CFrame stuff
mhm
is it a model?
PivotOffset only exist for models
uhh
local function createHand(length, width, yOffset)
local part = Instance.new("Part")
part.Size = Vector3.new(width, 0.1, length)
part.Material = Enum.Material.Neon
part.PivotOffset = CFrame.new(0, -(yOffset + 0.1), length / 2)
part.Anchored = true
part.Parent = workspace
return part
end
local function positionHand(hand, fraction)
hand:PivotTo(CFrame.fromEulerAnglesXYZ(0, -fraction * 2 * math.pi, 0))
end
-- Create dial
for i = 0, 11 do
local dialPart = Instance.new("Part")
dialPart.Size = Vector3.new(0.2, 0.2, 1)
dialPart.TopSurface = Enum.SurfaceType.Smooth
if i == 0 then
dialPart.Size = Vector3.new(0.2, 0.2, 2)
dialPart.Color = Color3.new(1, 0, 0)
end
dialPart.PivotOffset = CFrame.new(0, -0.1, 10.5)
dialPart.Anchored = true
dialPart:PivotTo(CFrame.fromEulerAnglesXYZ(0, (i / 12) * 2 * math.pi, 0))
dialPart.Parent = workspace
end
-- Create hands
local hourHand = createHand(7, 1, 0)
local minuteHand = createHand(10, 0.6, 0.1)
local secondHand = createHand(11, 0.2, 0.2)
-- Run clock
while true do
local components = os.date("*t")
positionHand(hourHand, (components.hour + components.min / 60) / 12)
positionHand(minuteHand, (components.min + components.sec / 60) / 60)
positionHand(secondHand, components.sec / 60)
task.wait()
end
maybe this helps
the documentation creates a clock aswell
yeah but imma be real i cant understand it
i already did my fair share of trying to understand it from the docs
I dont rlly understand pivotoffset rn 
what is the diffrence between pivotoffset and just pivotto
OHHH
I get it
so you want to set the pivot from red to yellow
right
ye
im kinda in a hurry rn
I had to go 3 mins ago
look
I think yojur problem is
that your doing the pivot in the world
the part has a pivotoffset of 0,0,0
and you can like move it in its own world
then this huge number
alr try to fix this wehn it doesnt work im back home in like 30mins and ima help you
figure it out
gl
does it work
Honestly if i were you id just change the pivot y (or other one)
Not the whole value
ykw i think i'll just use welds instead
Lazy but respectful 👍