When I just use a LocalScript to make the character follow the mouse, it works fine. But when I try to make it work with FilteringEnabled, it goes weird.

--Script

game.ReplicatedStorage:WaitForChild("RemoteEvent6").OnServerEvent:Connect(function(player, p)
	local torso = player.Character.Torso
	local dir = (p - torso.Position) * Vector3.new(1, 0, 1)
	torso.CFrame = CFrame.new(torso.Position, torso.Position + dir)
end)

--LocalScript

Player.CharacterAdded:Connect(function()
	
	repeat wait() until Player.Character.Torso and Player.Character.Humanoid
	
	while Player.Character:FindFirstChild("Humanoid").Health > 0 do
		game.ReplicatedStorage:WaitForChild("RemoteEvent6"):FireServer(Mouse.Hit.p)
		wait()
	end
	
end)

The character becomes stuck at one position. Although trying to move will make the character move just a bit, the character is just stuck. If I increase the delay in the while loop, the character can move around a bit, but still every so often gets stuck for some time when the loop runs again. I think it's because the LocalScript sends the player information and by the time the information is replicated over to the server, the player information-the character's torso's position-is already the old one. I hope that made sense.

2 comments

0

FE checks server scripts and if a server script attempts to move the Character it will be countered. Both scripts should be local.

0

Wait you mean server scripts are not able to change a character's position?