Character face toward mouse in server script

I changed it to that but it’s still appearing
https://i.gyazo.com/1de61df62011568ef4e4373fda715a59.mp4
You can see the bullet is spawning in the same place no matter where my humanoidrootpart is facing

Could you not just set the starting position of the bullet to your HumanoidRootPart every time the bullet fires?

That’s what I did, in the server, like i said in the post the rotating script is a local script, so the server does not know when it is rotating, so other players cannot see my humanoidrootpart rotating neither

1 Like

Hmm. Try using remote events. Remote events can only be fired 20 times a second, however. You’re in a tricky situation.

Off the top of my head, I think the easiest way to solve your issue would be to have 4 remote events, and cycle through each one.

Fire the first one, task.wait(0.05), Fire the second remote event, task.wait(0.05), Fire the third remote event, etc. The more remote events you use, the less choppy the updating should look.

1 Like

This might not be the most efficient way, but I’ve seen others recommend this system, and I can’t think of anything else off the top of my head

I’m going to make a post about this, because this is something that I want to know at some point, if it’s not the most efficient way.

Edit 2:

For whatever reason, it says online that a remote event can only be fired 20 times a second (which is not true), so you would only need 1 remote event.

(If you see this, please send a reply. Devforum doesn’t allow me to send more than 3 replies in a row)

1 Like

but wouldn’t that make the server laggy? it’s firing the remote every frame to the server, sorry for the late reply

It wouldn’t make things laggy, since it’s still under 1 event. Think of it like this:

A server script detects a .Touched event 60 times a second. This won’t lag the game, since it’s all being detected by 1 event.

Firing one remote event 60 times a second is no different.

1 Like

Sorry, it’s a little difficult to explain haha. I keep confusing remote events with script events (Part.Touched:Connect stuff)

Could you not use shift lock?
Something like this

local function ToggleLock()
	local CameraController = cameras.activeCameraController
	local MouseLockController = cameras.activeMouseLockController
	CenterLocked = not CenterLocked
	if CenterLocked then
		if MouseLockController:GetIsMouseLocked() then -- toggle shift lock off
			MouseLockController:OnMouseLockToggled()
		end
		CameraController:SetMouseLockOffset(Vector3.new())
		CameraController:SetIsMouseLocked(true)
		BoundKeys.Value = "" -- disables shift lock toggle
	else
		CameraController:SetIsMouseLocked(false)
		BoundKeys.Value = OldBoundKeys -- restores shift lock toggle
	end
end

That is also a good idea which I didn’t think of. The issue with shift lock is that your mouse would have to be locked to the middle of your screen.

The video attached is what I would assume they want their system to function like.

1 Like

You should probably use CharacterRootPosition and spawn the bullets at that vector
You would have to get the vector first of course

HumanoidRootPart* -------------

Yes, that’s what we were trying to do. I recommended remote events to bring the information from the client to the server.

Maybe but it is it spawning at the torso or is that the problem

@Smartmunkee please read this post. The issue is that the player is only being rotated on their screen, since it’s in a local script. And the bullets are not spawning at the same place as the player.

We have already identified the issue, and I gave them a straight forward answer on the most efficient way to solve their issue. I’m just waiting on a reply or for them to test it. Feedback and advice is welcome

Could you use a remote event to keep it firing at the torso/root part

1 Like

Yes, that is what I recommended to them already

Btw task.wait I think can only run task.wait(0.03)