Can't get a mesh to rotate


Perhaps they’re causing issues. Also this will get fast quickly, perhaps set a max speed.

local RobuxIcon = script.Parent
local speed = 1

While true do
speed = speed + 1

RobuxIcon.Cframe = RobuxIcon.Cframe * Cframe.Angles(--the rest)

task.wait()
end

I tested it on a MeshPart and it did rotate correctly for me

Also, in Luau you can use += so there’s no need to do:

I just don’t understand what’s preventing the mesh to move in this game but not in the testing server

This is quite strange since there doesn’t seem to be anything shown in the screenshot that could cause this problem to happen

Out of curiosity, how is the script currently written like?

If it’s touching another part/baseplate there may be a weld attached.

local speed = 1

local RobuxsIcon = script.Parent

local RobuxIconCFrame = RobuxsIcon.CFrame

while true do
	speed += 1

	RobuxsIcon.CFrame = RobuxIconCFrame * CFrame.Angles(0, math.rad(speed), 0)

	task.wait()
end

You still connecting the part to 2 variables and then setting them to each other. Try just one variable.

1 Like

Doing this like you’re suggesting would only cause the MeshPart to spin very fast:

local speed = 1

local RobuxsIcon = script.Parent

while true do
	speed += 1

	RobuxsIcon.CFrame = RobuxsIcon.CFrame * CFrame.Angles(0, math.rad(speed), 0)

	task.wait()
end

@Joeys2Valid At this point the only possible option I can think of is that another script is blocking the MeshPart from rotating, but unfortunately this means you’ll need to carefully check every script inside of your game to find the culprit

The only thing i can think of might be some other meshparts I put code in to move slightly

local TweenService = game:GetService("TweenService")

local Grass = script.Parent

local i = 0

while true do
	local tween = TweenService:Create(Grass, TweenInfo.new(0.3), {Rotation = Vector3.new(i, 0, 0)})

	tween:Play()
	i = i + 0.2

	wait(0.3)

	i = i - 0.1
	tween:Play()

	i = i + 0.2

	if i >= 3 then
		i = 0
		tween:Play()
	end

	wait(0)
end

Wait is the script you’re showing the full script or only a part of it?

I’m talking about the script that rotates the MeshPart btw

That’s the full script for the meshpart I want to rotate.

1 Like

image
That is correct but you can just set the speed you want.

local speed = 0.1 or 0.001 etc – any speed you want

while loop

remove speed increase

spin part with speed variable

end

I don’t think this script is causing the problem since the RobuxsIcon isn’t present, unless the loop is being run in the same script as the one that rotates the RobuxsIcon

You can always tween the part indefinitely

1 Like

Would running too many of the same script have a cause in it?

Wait how many scripts are doing the same thing?

nearly about 4,000 lines of code.

If you were to do something like this in the same script:

while true do
	task.wait()
end

while true do
	task.wait()
end

the second loop will never run since it’s being blocked by the first loop, so you’ll need to run the first loop in a separate thread by doing this:

task.spawn(function()
	while true do
		task.wait()
	end
end)

while true do
	task.wait()
end

Sounds like you need to sort out your scripts before doing much else. Btw what other things are you trying to do with this part?