Rotate a "dummy NPC" locally using a slider

What do you want to achieve?

i am making a place with a “character creation” system, and one of the features is a slider at the bottom of the screen that allows you to rotate your character between -180 degrees and 180 degrees.

this operation is done locally because i’m testing out performing all the “character creation” operations on a single “dummy” in the workspace, but i want to make it so multiple players can be in the same server while doing it.

What is the issue?

the problem is, every time i use a localscript in a GUI to change the rotation of the dummy with SetPrimaryPartCFrame(), it resets orientation as soon as the rotation “stops”.
ezgif-1-9d851b16c21f
i was worried it was a problem with the slider, so instead i tried to use a console command client-side to change rotation. it looks like this:

local Dummy = workspace.Dummy
local PPCF = Dummy:GetPrimaryPartCFrame()
Dummy:SetPrimaryPartCFrame(PPCF * CFrame.Angles(0, math.rad(50), 0))

however, the same problem happened; as soon as i stopped sending the commands, the dummy’s rotation would reset.
ezgif-1-cbb3b5868441

What solutions have you tried so far?

the game currently has four scripts total:

  • a (regular) script that applies the “idle” animation onto the dummy.
  • a localscript that controls the slider.
  • a localscript that controls the dummy’s rotation.
  • a localscript that fixes the camera onto the dummy, but doesn’t interact with it at all.

naturally, i disabled all (but the last one) of these and used the console command client-side; same thing happened.

i found out that by using the console script server-side, the problem doesn’t happen and the character stays rotated. go figure, i guess.

the dummy’s Humanoid had an “autorotate” property that i disabled, but it turns out it wasn’t really relevant in my case anyways because the Dummy isn’t moving at all. also, it didn’t fix the problem.

if i remove the humanoid, the rotation starts functioning clientside… however, it obviously breaks animations and also the ability to attach hats and shirts and pants and whatnot to the dummy. which is kind of super important to me, so i don’t want to delete the humanoid.

using the “clients and servers” testing function doesn’t affect the outcome at all.

1 Like

Sounds like a network ownership issue. How is the dummy being managed, is it just a model in the workspace that the client modifies? Does the client itself not build/clone a dummy and place it?

The client should be responsible for both creating and modifying the NPC so that other clients don’t influence any changes on it. This includes the idle animation. Since there’s a running server-sided script in the NPC, I’m assuming that the client doesn’t have full control over the NPC.

2 Likes

huh, that makes perfect sense and also never occurred to me. thanks for the instant reply!

1 Like