Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My rotating scripy only rotates the part once and stops why?

local Run = game:GetService("RunService")
local cframe = game.Workspace.AvatarEditing.CircleUnderAv.Avatar.PrimaryPart.CFrame -- Current CFrame
	 
	
Run.RenderStepped:Connect(function()
game.Workspace.AvatarEditing.CircleUnderAv.Avatar:SetPrimaryPartCFrame(cframe * CFrame.Angles(0, math.rad(10), 0))
end)

it only rotates it once. How can i make it so it keep rotating the model over and over?

2 answers

You need to update the cframe variable after every action like this

local Run = game:GetService("RunService")
local cframe = game.Workspace.AvatarEditing.CircleUnderAv.Avatar.PrimaryPart.CFrame	 
	 
Run.RenderStepped:Connect(function()
	game.Workspace.AvatarEditing.CircleUnderAv.Avatar:SetPrimaryPartCFrame(cframe * 		 
        CFrame.Angles(0, math.rad(10), 0))
	cframe = game.Workspace.AvatarEditing.CircleUnderAv.Avatar.PrimaryPart.CFrame
end)

Don't save the PrimaryPart's CFrame as a variable. That will just set it to the CFrame at the time it was indexed.

2 comments

0

so how can i fix it for it to keep rotating?

0

get rid of the variable and replace it with model.PrimaryPart.CFrame or do as the answer said below and constantly update the cframe variable

This discussion is preserved as it was. New answers, comments, and votes are closed.