Attachment Flip With Random Rotating Script

im not a big fan of math and some kind of codeline like this

the problem is my particle ring keep flip sometimes, its unsastified you know

so i want to make it rotate randomly and not flipping

local Character = script.Parent
local RootPart = Character.HumanoidRootPart

local RunService = game:GetService("RunService")
local rad = math.rad
local clock = os.clock
local noise = math.noise
local random = math.random
local Heartbeat = RunService.Heartbeat

local BigRing = RootPart.Bigring
local SmallRing = RootPart.Smallring

local xseed = random(10000, 100000)
local yseed = random(10000, 100000)
local zseed = random(10000, 100000)

local xseed2 = random(10000, 100000)
local yseed2 = random(10000, 100000)
local zseed2 = random(10000, 100000)

while true do
	local x = noise(xseed, clock() % 1000 * 0.1) * 360
	local y = noise(yseed, clock() % 1000 * 0.1) * 360
	local z = noise(zseed, clock() % 1000 * 0.1) * 360

	local x2 = noise(xseed2, clock() % 1000 * 0.1) * 360
	local y2 = noise(yseed2, clock() % 1000 * 0.1) * 360
	local z2 = noise(zseed2, clock() % 1000 * 0.1) * 360

	SmallRing.CFrame = CFrame.new(SmallRing.Position) * CFrame.Angles(rad(x), rad(y), rad(z))
	BigRing.CFrame = CFrame.new(BigRing.Position) * CFrame.Angles(rad(x2), rad(y2), rad(z2))
	Heartbeat:Wait()
end
1 Like

Don’t use Heartbeat:Wait() in a while true loop. Just do RunService.Heartbeat:Connect(function). While true loops do not run accurately to game deltatime.

2 Likes

thanks about that but it doesnt solve the problem i have rn

1 Like

After watching the video, I made an observation. When the disks go to a horizontal position, that is when they flip. My prediction: The disks probably flip the rotation goes from 360° to 0°. You might have to add the change in angles instead of multiplying angles.

1 Like

messing around abit and found out that its not script problem

but particle somehow flipped when it rotating at somepoint

so im about to change it from particle to decal

easy fix

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.